Skip to contentSkip to conversation

drm/amd/powerplay: fix a warning in pp_hw_init

PATCH In review Alex Deucher 2 participants 3 messages Sep 29, 2017 – Oct 1, 2017 2 messages not in the archive

Subsystems (2)
lore
Share & tools
lore
#0 lore raw

PATCH 1/1 drm/amd/powerplay: fix a warning in pp_hw_init

Make sure hwmgr is valid.

---
 drivers/gpu/drm/amd/powerplay/amd_powerplay.c | 5 +++--
 1 file changed, 3 insertions(+), 2 deletions(-)
drivers/gpu/drm/amd/powerplay/amd_powerplay.c +3 -2
index 44b0616..e96ab0b 100644
@@ -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;
 
 }
Signature · 6 lines
2.5.5

_______________________________________________
amd-gfx mailing list
[email protected]
https://lists.freedesktop.org/mailman/listinfo/amd-gfx

A message that is not in the archive (sent off-list or not yet received): 1506703087-26162-1-git-send-email-alexander.deucher-5C7GfCeVMHo@public.gmane.org

#2 lore raw

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:[email protected]] On Behalf Of Alex Deucher
Sent: Saturday, September 30, 2017 12:38 AM
To: [email protected]
Cc: Deucher, Alexander
Subject: [PATCH] drm/amd/powerplay: fix a warning in pp_hw_init

Make sure hwmgr is valid.

---
 drivers/gpu/drm/amd/powerplay/amd_powerplay.c | 5 +++--
 1 file changed, 3 insertions(+), 2 deletions(-)
drivers/gpu/drm/amd/powerplay/amd_powerplay.c +3 -2
index 44b0616..e96ab0b 100644
@@ -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
[email protected]
https://lists.freedesktop.org/mailman/listinfo/amd-gfx

From e253f12b5fd6c44a0ce6beb342319ea053c3ec29 Mon Sep 17 00:00:00 2001
From: Rex Zhu <[email protected]>
Date: Sat, 30 Sep 2017 10:20:52 +0800
Subject: [PATCH] drm/amd/powerplay: fix a logic error in pp_hw_init

Change-Id I8607e51a0e4153b36268e2bcf4fe594c2bfbfe23
---
 drivers/gpu/drm/amd/powerplay/amd_powerplay.c | 9 ++++-----
 1 file changed, 4 insertions(+), 5 deletions(-)
drivers/gpu/drm/amd/powerplay/amd_powerplay.c +4 -5
index df70cc7..586cab7 100644
@@ -163,12 +163,11 @@ static int pp_hw_init(void *handle)
 		}
 		if (ret == PP_DPM_DISABLED)
 			goto exit;
+		ret = hwmgr_hw_init(pp_handle);
+		if (ret)
+			goto exit;
 	}
-
-	ret = hwmgr_hw_init(pp_handle);
-	if (ret)
-		goto exit;
-	return 0;
+	return ret;
 exit:
 	pp_handle->pm_en = 0;
 	cgs_notify_dpm_enabled(hwmgr->device, false);
Signature · 1 line
1.9.1

_______________________________________________
amd-gfx mailing list
[email protected]
https://lists.freedesktop.org/mailman/listinfo/amd-gfx

A message that is not in the archive (sent off-list or not yet received): CY4PR12MB1687AA55C8E5F3DB77EAE4B3FB7F0-rpdhrqHFk06Y0SjTqZDccQdYzm3356FpvxpqHgZTriW3zl9H0oFU5g@public.gmane.org

author Acked-by
#4 lore raw
Quoted 4 lines · Rex

Hi Alex,

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

Quoted 45 lines

Best Regards
Rex

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

Make sure hwmgr is valid.

---
 drivers/gpu/drm/amd/powerplay/amd_powerplay.c | 5 +++--
 1 file changed, 3 insertions(+), 2 deletions(-)
drivers/gpu/drm/amd/powerplay/amd_powerplay.c +3 -3
index 44b0616..e96ab0b 100644
@@ -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

Quoted 4 lines

_______________________________________________
amd-gfx mailing list
[email protected]
https://lists.freedesktop.org/mailman/listinfo/amd-gfx

_______________________________________________
amd-gfx mailing list
[email protected]
https://lists.freedesktop.org/mailman/listinfo/amd-gfx