[PATCH] drm/amd/powerplay: fix a warning in pp_hw_init

Zhu, Rex Rex.Zhu at amd.com
Sat Sep 30 02:41:40 UTC 2017


Hi Alex,

Thanks for pointing out the logic error in pp_hw_init.
Please review the attached patch.

Best Regards
Rex



-----Original Message-----
From: amd-gfx [mailto:amd-gfx-bounces at lists.freedesktop.org] On Behalf Of Alex Deucher
Sent: Saturday, September 30, 2017 12:38 AM
To: amd-gfx at lists.freedesktop.org
Cc: Deucher, Alexander
Subject: [PATCH] drm/amd/powerplay: fix a warning in pp_hw_init

Make sure hwmgr is valid.

Signed-off-by: Alex Deucher <alexander.deucher at amd.com>
---
 drivers/gpu/drm/amd/powerplay/amd_powerplay.c | 5 +++--
 1 file changed, 3 insertions(+), 2 deletions(-)

diff --git a/drivers/gpu/drm/amd/powerplay/amd_powerplay.c b/drivers/gpu/drm/amd/powerplay/amd_powerplay.c
index 44b0616..e96ab0b 100644
--- a/drivers/gpu/drm/amd/powerplay/amd_powerplay.c
+++ b/drivers/gpu/drm/amd/powerplay/amd_powerplay.c
@@ -146,7 +146,7 @@ static int pp_hw_init(void *handle)  {
 	int ret = 0;
 	struct pp_instance *pp_handle = (struct pp_instance *)handle;
-	struct pp_hwmgr *hwmgr;
+	struct pp_hwmgr *hwmgr = NULL;
 
 	ret = pp_check(pp_handle);
 
@@ -171,7 +171,8 @@ static int pp_hw_init(void *handle)
 	return 0;
 exit:
 	pp_handle->pm_en = 0;
-	cgs_notify_dpm_enabled(hwmgr->device, false);
+	if (hwmgr)
+		cgs_notify_dpm_enabled(hwmgr->device, false);
 	return 0;
 
 }
--
2.5.5

_______________________________________________
amd-gfx mailing list
amd-gfx at lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/amd-gfx
-------------- next part --------------
A non-text attachment was scrubbed...
Name: 0001-drm-amd-powerplay-fix-a-logic-error-in-pp_hw_init.patch
Type: application/octet-stream
Size: 1012 bytes
Desc: 0001-drm-amd-powerplay-fix-a-logic-error-in-pp_hw_init.patch
URL: <https://lists.freedesktop.org/archives/amd-gfx/attachments/20170930/49976df9/attachment.obj>


More information about the amd-gfx mailing list