Skip to content

Commit e008fa6

Browse files
Navidemalexdeucher
authored andcommitted
drm/amdgpu: fix ref count leak in amdgpu_display_crtc_set_config
in amdgpu_display_crtc_set_config, the call to pm_runtime_get_sync increments the counter even in case of failure, leading to incorrect ref count. In case of failure, decrement the ref count before returning. Signed-off-by: Navid Emamdoost <[email protected]> Signed-off-by: Alex Deucher <[email protected]>
1 parent 5509ac6 commit e008fa6

File tree

1 file changed

+3
-2
lines changed

1 file changed

+3
-2
lines changed

drivers/gpu/drm/amd/amdgpu/amdgpu_display.c

+3-2
Original file line numberDiff line numberDiff line change
@@ -282,7 +282,7 @@ int amdgpu_display_crtc_set_config(struct drm_mode_set *set,
282282

283283
ret = pm_runtime_get_sync(dev->dev);
284284
if (ret < 0)
285-
return ret;
285+
goto out;
286286

287287
ret = drm_crtc_helper_set_config(set, ctx);
288288

@@ -297,7 +297,7 @@ int amdgpu_display_crtc_set_config(struct drm_mode_set *set,
297297
take the current one */
298298
if (active && !adev->have_disp_power_ref) {
299299
adev->have_disp_power_ref = true;
300-
return ret;
300+
goto out;
301301
}
302302
/* if we have no active crtcs, then drop the power ref
303303
we got before */
@@ -306,6 +306,7 @@ int amdgpu_display_crtc_set_config(struct drm_mode_set *set,
306306
adev->have_disp_power_ref = false;
307307
}
308308

309+
out:
309310
/* drop the power reference we got coming in here */
310311
pm_runtime_put_autosuspend(dev->dev);
311312
return ret;

0 commit comments

Comments
 (0)