[patch] drm/amdgpu: double unlock in amdgpu_set_dpm_forced_performance_level()

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



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

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;
 }
 
_______________________________________________
dri-devel mailing list
dri-devel@xxxxxxxxxxxxxxxxxxxxx
http://lists.freedesktop.org/mailman/listinfo/dri-devel




[Index of Archives]     [Linux DRI Users]     [Linux Intel Graphics]     [Linux USB Devel]     [Video for Linux]     [Linux Audio Users]     [Yosemite News]     [Linux Kernel]     [Linux SCSI]     [XFree86]     [Linux USB Devel]     [Video for Linux]     [Linux Audio Users]     [Linux Kernel]     [Linux SCSI]     [XFree86]
  Powered by Linux