[patch] drm/amdgpu: double unlock in amdgpu_set_dpm_forced_performance_level()
Dan Carpenter
dan.carpenter at oracle.com
Mon Jan 4 12:42:01 PST 2016
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 at 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;
}
More information about the dri-devel
mailing list