[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;
 }
 
--
To unsubscribe from this list: send the line "unsubscribe kernel-janitors" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at  http://vger.kernel.org/majordomo-info.html



[Index of Archives]     [Kernel Development]     [Kernel Announce]     [Kernel Newbies]     [Linux Networking Development]     [Share Photos]     [IDE]     [Security]     [Git]     [Netfilter]     [Yosemite News]     [MIPS Linux]     [ARM Linux]     [Device Mapper]

  Powered by Linux