* [patch] drm/amdgpu: double unlock in amdgpu_set_dpm_forced_performance_level()
@ 2016-01-04 20:42 Dan Carpenter
0 siblings, 0 replies; only message in thread
From: Dan Carpenter @ 2016-01-04 20:42 UTC (permalink / raw)
To: David Airlie, Rex Zhu
Cc: Alex Deucher, Jammy Zhou, Christian König, Daniel Vetter,
Sonny Jiang, dri-devel, kernel-janitors
We recently moved the locking around and accidentally introduced a
double unlock bug.
Fixes: 1b5708ffb103 ('drm/amdgpu: export amd_powerplay_func to amdgpu and other ip block')
Signed-off-by: Dan Carpenter <dan.carpenter@oracle.com>
diff --git a/drivers/gpu/drm/amd/amdgpu/amdgpu_pm.c b/drivers/gpu/drm/amd/amdgpu/amdgpu_pm.c
index 3b78982..872e586 100644
--- a/drivers/gpu/drm/amd/amdgpu/amdgpu_pm.c
+++ b/drivers/gpu/drm/amd/amdgpu/amdgpu_pm.c
@@ -147,8 +147,7 @@ static ssize_t amdgpu_set_dpm_forced_performance_level(struct device *dev,
} else if (strncmp("auto", buf, strlen("auto")) = 0) {
level = AMDGPU_DPM_FORCED_LEVEL_AUTO;
} else {
- count = -EINVAL;
- goto fail;
+ return -EINVAL;
}
if (adev->pp_enabled)
@@ -157,18 +156,18 @@ static ssize_t amdgpu_set_dpm_forced_performance_level(struct device *dev,
mutex_lock(&adev->pm.mutex);
if (adev->pm.dpm.thermal_active) {
count = -EINVAL;
- goto fail;
+ goto unlock;
}
ret = amdgpu_dpm_force_performance_level(adev, level);
- if (ret)
+ if (ret) {
count = -EINVAL;
- else
- adev->pm.dpm.forced_level = level;
+ goto unlock;
+ }
+ adev->pm.dpm.forced_level = level;
+
+unlock:
mutex_unlock(&adev->pm.mutex);
}
-fail:
- mutex_unlock(&adev->pm.mutex);
-
return count;
}
^ permalink raw reply related [flat|nested] only message in thread
only message in thread, other threads:[~2016-01-04 20:42 UTC | newest]
Thread overview: (only message) (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2016-01-04 20:42 [patch] drm/amdgpu: double unlock in amdgpu_set_dpm_forced_performance_level() Dan Carpenter
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).