Commit 93d3e58c authored by Aditya Pakki's avatar Aditya Pakki Committed by Greg Kroah-Hartman

drm/radeon: fix multiple reference count leak

[ Upstream commit 6f2e8acd ]

On calling pm_runtime_get_sync() the reference count of the device
is incremented. In case of failure, decrement the
reference count before returning the error.
Signed-off-by: default avatarAditya Pakki <pakki001@umn.edu>
Signed-off-by: default avatarAlex Deucher <alexander.deucher@amd.com>
Signed-off-by: default avatarSasha Levin <sashal@kernel.org>
parent 74d20579
...@@ -882,8 +882,10 @@ radeon_lvds_detect(struct drm_connector *connector, bool force) ...@@ -882,8 +882,10 @@ radeon_lvds_detect(struct drm_connector *connector, bool force)
if (!drm_kms_helper_is_poll_worker()) { if (!drm_kms_helper_is_poll_worker()) {
r = pm_runtime_get_sync(connector->dev->dev); r = pm_runtime_get_sync(connector->dev->dev);
if (r < 0) if (r < 0) {
pm_runtime_put_autosuspend(connector->dev->dev);
return connector_status_disconnected; return connector_status_disconnected;
}
} }
if (encoder) { if (encoder) {
...@@ -1028,8 +1030,10 @@ radeon_vga_detect(struct drm_connector *connector, bool force) ...@@ -1028,8 +1030,10 @@ radeon_vga_detect(struct drm_connector *connector, bool force)
if (!drm_kms_helper_is_poll_worker()) { if (!drm_kms_helper_is_poll_worker()) {
r = pm_runtime_get_sync(connector->dev->dev); r = pm_runtime_get_sync(connector->dev->dev);
if (r < 0) if (r < 0) {
pm_runtime_put_autosuspend(connector->dev->dev);
return connector_status_disconnected; return connector_status_disconnected;
}
} }
encoder = radeon_best_single_encoder(connector); encoder = radeon_best_single_encoder(connector);
...@@ -1166,8 +1170,10 @@ radeon_tv_detect(struct drm_connector *connector, bool force) ...@@ -1166,8 +1170,10 @@ radeon_tv_detect(struct drm_connector *connector, bool force)
if (!drm_kms_helper_is_poll_worker()) { if (!drm_kms_helper_is_poll_worker()) {
r = pm_runtime_get_sync(connector->dev->dev); r = pm_runtime_get_sync(connector->dev->dev);
if (r < 0) if (r < 0) {
pm_runtime_put_autosuspend(connector->dev->dev);
return connector_status_disconnected; return connector_status_disconnected;
}
} }
encoder = radeon_best_single_encoder(connector); encoder = radeon_best_single_encoder(connector);
...@@ -1250,8 +1256,10 @@ radeon_dvi_detect(struct drm_connector *connector, bool force) ...@@ -1250,8 +1256,10 @@ radeon_dvi_detect(struct drm_connector *connector, bool force)
if (!drm_kms_helper_is_poll_worker()) { if (!drm_kms_helper_is_poll_worker()) {
r = pm_runtime_get_sync(connector->dev->dev); r = pm_runtime_get_sync(connector->dev->dev);
if (r < 0) if (r < 0) {
pm_runtime_put_autosuspend(connector->dev->dev);
return connector_status_disconnected; return connector_status_disconnected;
}
} }
if (radeon_connector->detected_hpd_without_ddc) { if (radeon_connector->detected_hpd_without_ddc) {
...@@ -1665,8 +1673,10 @@ radeon_dp_detect(struct drm_connector *connector, bool force) ...@@ -1665,8 +1673,10 @@ radeon_dp_detect(struct drm_connector *connector, bool force)
if (!drm_kms_helper_is_poll_worker()) { if (!drm_kms_helper_is_poll_worker()) {
r = pm_runtime_get_sync(connector->dev->dev); r = pm_runtime_get_sync(connector->dev->dev);
if (r < 0) if (r < 0) {
pm_runtime_put_autosuspend(connector->dev->dev);
return connector_status_disconnected; return connector_status_disconnected;
}
} }
if (!force && radeon_check_hpd_status_unchanged(connector)) { if (!force && radeon_check_hpd_status_unchanged(connector)) {
......
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