[PATCH 48/88] drm/amdgpu fix amdgpu.dpm=0 (v2)

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

 



From: Sonny Jiang <sonny.jiang@xxxxxxx>

Fix crash when disabling dpm.

v2: agd5f: fix coding style, cleanup commit message

Signed-off-by: Sonny Jiang <sonny.jiang@xxxxxxx>
Reviewed-by: Alex Deucher <alexander.deucher@xxxxxxx>
---
 drivers/gpu/drm/amd/amdgpu/cz_dpm.c | 17 +++++++++++++----
 1 file changed, 13 insertions(+), 4 deletions(-)

diff --git a/drivers/gpu/drm/amd/amdgpu/cz_dpm.c b/drivers/gpu/drm/amd/amdgpu/cz_dpm.c
index e56f54b..adf4dbc 100644
--- a/drivers/gpu/drm/amd/amdgpu/cz_dpm.c
+++ b/drivers/gpu/drm/amd/amdgpu/cz_dpm.c
@@ -1206,10 +1206,7 @@ static int cz_dpm_enable(struct amdgpu_device *adev)
 
 static int cz_dpm_hw_init(struct amdgpu_device *adev)
 {
-	int ret;
-
-	if (!amdgpu_dpm)
-		return 0;
+	int ret = 0;
 
 	mutex_lock(&adev->pm.mutex);
 
@@ -1229,6 +1226,12 @@ static int cz_dpm_hw_init(struct amdgpu_device *adev)
 		return ret;
 	}
 
+	if (!amdgpu_dpm) {
+		adev->pm.dpm_enabled = false;
+		mutex_unlock(&adev->pm.mutex);
+		return ret;
+	}
+
 	/* cz dpm setup asic */
 	cz_dpm_setup_asic(adev);
 
@@ -1326,6 +1329,12 @@ static int cz_dpm_resume(struct amdgpu_device *adev)
 		return ret;
 	}
 
+	if (!amdgpu_dpm) {
+		adev->pm.dpm_enabled = false;
+		mutex_unlock(&adev->pm.mutex);
+		return ret;
+	}
+
 	/* cz dpm setup asic */
 	cz_dpm_setup_asic(adev);
 
-- 
1.8.3.1

_______________________________________________
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