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 <alex.hung@amd.com>
Signed-off-by: Mario Limonciello <mario.limonciello@amd.com>
Signed-off-by: Wayne Lin <wayne.lin@amd.com>
Tested-by: Daniel Wheeler <daniel.wheeler@amd.com>
Signed-off-by: Alex Deucher <alexander.deucher@amd.com>
This commit is contained in:
Mario Limonciello 2025-02-17 22:58:37 -06:00 committed by Alex Deucher
parent d13fbeb74b
commit aca9ec9b05

View File

@ -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)