Commit aca9ec9b authored by Mario Limonciello's avatar Mario Limonciello Committed by Alex Deucher
Browse files

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: default avatarAlex Hung <alex.hung@amd.com>
Signed-off-by: default avatarMario Limonciello <mario.limonciello@amd.com>
Signed-off-by: default avatarWayne Lin <wayne.lin@amd.com>
Tested-by: default avatarDaniel Wheeler <daniel.wheeler@amd.com>
Signed-off-by: default avatarAlex Deucher <alexander.deucher@amd.com>
parent d13fbeb7
Loading
Loading
Loading
Loading
+2 −6
Original line number Diff line number Diff line
@@ -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)