Commit 9ee485bd authored by Johan Hovold's avatar Johan Hovold Committed by Neil Armstrong

drm/bridge: aux-hpd: fix OF node leaks

The two device node references taken during allocation need to be
dropped when the auxiliary device is freed.

Fixes: 6914968a ("drm/bridge: properly refcount DT nodes in aux bridge drivers")
Cc: Dmitry Baryshkov <dmitry.baryshkov@linaro.org>
Cc: Neil Armstrong <neil.armstrong@linaro.org>
Signed-off-by: default avatarJohan Hovold <johan+linaro@kernel.org>
Reviewed-by: default avatarNeil Armstrong <neil.armstrong@linaro.org>
Reviewed-by: default avatarDmitry Baryshkov <dmitry.baryshkov@linaro.org>
Reviewed-by: default avatarBjorn Andersson <andersson@kernel.org>
Link: https://lore.kernel.org/r/20240217150228.5788-2-johan+linaro@kernel.orgSigned-off-by: default avatarNeil Armstrong <neil.armstrong@linaro.org>
Link: https://patchwork.freedesktop.org/patch/msgid/20240217150228.5788-2-johan+linaro@kernel.org
parent 1fa8d07a
...@@ -25,6 +25,7 @@ static void drm_aux_hpd_bridge_release(struct device *dev) ...@@ -25,6 +25,7 @@ static void drm_aux_hpd_bridge_release(struct device *dev)
ida_free(&drm_aux_hpd_bridge_ida, adev->id); ida_free(&drm_aux_hpd_bridge_ida, adev->id);
of_node_put(adev->dev.platform_data); of_node_put(adev->dev.platform_data);
of_node_put(adev->dev.of_node);
kfree(adev); kfree(adev);
} }
...@@ -74,6 +75,8 @@ struct device *drm_dp_hpd_bridge_register(struct device *parent, ...@@ -74,6 +75,8 @@ struct device *drm_dp_hpd_bridge_register(struct device *parent,
ret = auxiliary_device_init(adev); ret = auxiliary_device_init(adev);
if (ret) { if (ret) {
of_node_put(adev->dev.platform_data);
of_node_put(adev->dev.of_node);
ida_free(&drm_aux_hpd_bridge_ida, adev->id); ida_free(&drm_aux_hpd_bridge_ida, adev->id);
kfree(adev); kfree(adev);
return ERR_PTR(ret); return ERR_PTR(ret);
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment