Skip to content

Commit 6f2e8ac

Browse files
Aditya Pakkialexdeucher
authored andcommitted
drm/radeon: fix multiple reference count leak
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: Aditya Pakki <pakki001@umn.edu> Signed-off-by: Alex Deucher <alexander.deucher@amd.com>
1 parent 74a353f commit 6f2e8ac

File tree

1 file changed

+15
-5
lines changed

1 file changed

+15
-5
lines changed

drivers/gpu/drm/radeon/radeon_connectors.c

Lines changed: 15 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -879,8 +879,10 @@ radeon_lvds_detect(struct drm_connector *connector, bool force)
879879

880880
if (!drm_kms_helper_is_poll_worker()) {
881881
r = pm_runtime_get_sync(connector->dev->dev);
882-
if (r < 0)
882+
if (r < 0) {
883+
pm_runtime_put_autosuspend(connector->dev->dev);
883884
return connector_status_disconnected;
885+
}
884886
}
885887

886888
if (encoder) {
@@ -1025,8 +1027,10 @@ radeon_vga_detect(struct drm_connector *connector, bool force)
10251027

10261028
if (!drm_kms_helper_is_poll_worker()) {
10271029
r = pm_runtime_get_sync(connector->dev->dev);
1028-
if (r < 0)
1030+
if (r < 0) {
1031+
pm_runtime_put_autosuspend(connector->dev->dev);
10291032
return connector_status_disconnected;
1033+
}
10301034
}
10311035

10321036
encoder = radeon_best_single_encoder(connector);
@@ -1163,8 +1167,10 @@ radeon_tv_detect(struct drm_connector *connector, bool force)
11631167

11641168
if (!drm_kms_helper_is_poll_worker()) {
11651169
r = pm_runtime_get_sync(connector->dev->dev);
1166-
if (r < 0)
1170+
if (r < 0) {
1171+
pm_runtime_put_autosuspend(connector->dev->dev);
11671172
return connector_status_disconnected;
1173+
}
11681174
}
11691175

11701176
encoder = radeon_best_single_encoder(connector);
@@ -1247,8 +1253,10 @@ radeon_dvi_detect(struct drm_connector *connector, bool force)
12471253

12481254
if (!drm_kms_helper_is_poll_worker()) {
12491255
r = pm_runtime_get_sync(connector->dev->dev);
1250-
if (r < 0)
1256+
if (r < 0) {
1257+
pm_runtime_put_autosuspend(connector->dev->dev);
12511258
return connector_status_disconnected;
1259+
}
12521260
}
12531261

12541262
if (radeon_connector->detected_hpd_without_ddc) {
@@ -1657,8 +1665,10 @@ radeon_dp_detect(struct drm_connector *connector, bool force)
16571665

16581666
if (!drm_kms_helper_is_poll_worker()) {
16591667
r = pm_runtime_get_sync(connector->dev->dev);
1660-
if (r < 0)
1668+
if (r < 0) {
1669+
pm_runtime_put_autosuspend(connector->dev->dev);
16611670
return connector_status_disconnected;
1671+
}
16621672
}
16631673

16641674
if (!force && radeon_check_hpd_status_unchanged(connector)) {

0 commit comments

Comments
 (0)