From: Mario Limonciello Date: Tue, 18 Feb 2025 04:58:37 +0000 (-0600) Subject: drm/amd/display: Use scoped guard for amdgpu_dm_update_connector_after_detect() X-Git-Tag: v6.15-rc1~120^2~12^2~55 X-Git-Url: http://git.ipfire.org/?a=commitdiff_plain;h=aca9ec9b050c0900c3657ea4aba63d6d95073b22;p=thirdparty%2Fkernel%2Flinux.git drm/amd/display: Use scoped guard for amdgpu_dm_update_connector_after_detect() A scoped guard will release the mutex when it goes out of scope. Reviewed-by: Alex Hung Signed-off-by: Mario Limonciello Signed-off-by: Wayne Lin Tested-by: Daniel Wheeler Signed-off-by: Alex Deucher --- diff --git a/drivers/gpu/drm/amd/display/amdgpu_dm/amdgpu_dm.c b/drivers/gpu/drm/amd/display/amdgpu_dm/amdgpu_dm.c index 4ad9178228d4c..1b754c49896bd 100644 --- a/drivers/gpu/drm/amd/display/amdgpu_dm/amdgpu_dm.c +++ b/drivers/gpu/drm/amd/display/amdgpu_dm/amdgpu_dm.c @@ -3681,7 +3681,7 @@ void amdgpu_dm_update_connector_after_detect( * For S3 resume with headless use eml_sink to fake stream * because on resume connector->sink is set to NULL */ - mutex_lock(&dev->mode_config.mutex); + guard(mutex)(&dev->mode_config.mutex); if (sink) { if (aconnector->dc_sink) { @@ -3706,8 +3706,6 @@ void amdgpu_dm_update_connector_after_detect( } } - mutex_unlock(&dev->mode_config.mutex); - if (sink) dc_sink_release(sink); return; @@ -3737,7 +3735,7 @@ void amdgpu_dm_update_connector_after_detect( drm_dbg_kms(dev, "DCHPD: connector_id=%d: Old sink=%p New sink=%p\n", aconnector->connector_id, aconnector->dc_sink, sink); - mutex_lock(&dev->mode_config.mutex); + guard(mutex)(&dev->mode_config.mutex); /* * 1. Update status of the drm connector @@ -3799,8 +3797,6 @@ void amdgpu_dm_update_connector_after_detect( connector->state->content_protection = DRM_MODE_CONTENT_PROTECTION_DESIRED; } - mutex_unlock(&dev->mode_config.mutex); - update_subconnector_property(aconnector); if (sink)