drm/amd/powerplay: fix missed hwmgr check warning before call gfx_off_control handler

Submitted by Huang, Ray on June 5, 2018, 10:11 a.m.

Details

Message ID DM5PR12MB1338C0F00CF6715014170143EC660@DM5PR12MB1338.namprd12.prod.outlook.com
State New
Headers show
Series "drm/amd/powerplay: fix missed hwmgr check warning before call gfx_off_control handler" ( rev: 2 ) in AMD X.Org drivers

Not browsing as part of any series.

Commit Message

Huang, Ray June 5, 2018, 10:11 a.m.
Ping.

-----Original Message-----
From: amd-gfx [mailto:amd-gfx-bounces@lists.freedesktop.org] On Behalf Of Huang Rui

Sent: Friday, May 18, 2018 10:50 AM
To: Deucher, Alexander <Alexander.Deucher@amd.com>; Koenig, Christian <Christian.Koenig@amd.com>; amd-gfx@lists.freedesktop.org
Cc: Huang, Ray <Ray.Huang@amd.com>; Dan Carpenter <dan.carpenter@oracle.com>
Subject: [PATCH] drm/amd/powerplay: fix missed hwmgr check warning before call gfx_off_control handler

Patch 9667849bbb8d: "drm/amd/powerplay: add control gfxoff enabling in late init" from Mar 13, 2018, leads to the following static checker warning:

	drivers/gpu/drm/amd/amdgpu/../powerplay/amd_powerplay.c:194
pp_late_init()
	error: we previously assumed 'hwmgr' could be null (see line 185)

drivers/gpu/drm/amd/amdgpu/../powerplay/amd_powerplay.c

This patch fixes the warning to add hwmgr checking.

Reported-by: Dan Carpenter <dan.carpenter@oracle.com>
Signed-off-by: Huang Rui <ray.huang@amd.com>

---
 drivers/gpu/drm/amd/powerplay/amd_powerplay.c | 3 ++-
 1 file changed, 2 insertions(+), 1 deletion(-)

--
2.7.4

_______________________________________________
amd-gfx mailing list
amd-gfx@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/amd-gfx

Patch hide | download patch | download mbox

diff --git a/drivers/gpu/drm/amd/powerplay/amd_powerplay.c b/drivers/gpu/drm/amd/powerplay/amd_powerplay.c
index b493369..2d0e42f 100644
--- a/drivers/gpu/drm/amd/powerplay/amd_powerplay.c
+++ b/drivers/gpu/drm/amd/powerplay/amd_powerplay.c
@@ -191,7 +191,8 @@  static int pp_late_init(void *handle)
 	if (adev->pm.smu_prv_buffer_size != 0)
 		pp_reserve_vram_for_smu(adev);
 
-	if (hwmgr->hwmgr_func->gfx_off_control &&
+	if (hwmgr && hwmgr->hwmgr_func &&
+	    hwmgr->hwmgr_func->gfx_off_control &&
 	    (hwmgr->feature_mask & PP_GFXOFF_MASK)) {
 		ret = hwmgr->hwmgr_func->gfx_off_control(hwmgr, true);
 		if (ret)

Comments

Reviewed-by: Evan Quan <evan.quan@amd.com>


> -----Original Message-----

> From: amd-gfx [mailto:amd-gfx-bounces@lists.freedesktop.org] On Behalf

> Of Huang, Ray

> Sent: Tuesday, June 05, 2018 6:11 PM

> To: Huang, Ray <Ray.Huang@amd.com>; Deucher, Alexander

> <Alexander.Deucher@amd.com>; Koenig, Christian

> <Christian.Koenig@amd.com>; amd-gfx@lists.freedesktop.org

> Cc: Dan Carpenter <dan.carpenter@oracle.com>

> Subject: RE: [PATCH] drm/amd/powerplay: fix missed hwmgr check warning

> before call gfx_off_control handler

> 

> Ping.

> 

> -----Original Message-----

> From: amd-gfx [mailto:amd-gfx-bounces@lists.freedesktop.org] On Behalf

> Of Huang Rui

> Sent: Friday, May 18, 2018 10:50 AM

> To: Deucher, Alexander <Alexander.Deucher@amd.com>; Koenig, Christian

> <Christian.Koenig@amd.com>; amd-gfx@lists.freedesktop.org

> Cc: Huang, Ray <Ray.Huang@amd.com>; Dan Carpenter

> <dan.carpenter@oracle.com>

> Subject: [PATCH] drm/amd/powerplay: fix missed hwmgr check warning

> before call gfx_off_control handler

> 

> Patch 9667849bbb8d: "drm/amd/powerplay: add control gfxoff enabling in

> late init" from Mar 13, 2018, leads to the following static checker warning:

> 

> 	drivers/gpu/drm/amd/amdgpu/../powerplay/amd_powerplay.c:194

> pp_late_init()

> 	error: we previously assumed 'hwmgr' could be null (see line 185)

> 

> drivers/gpu/drm/amd/amdgpu/../powerplay/amd_powerplay.c

> 

> This patch fixes the warning to add hwmgr checking.

> 

> Reported-by: Dan Carpenter <dan.carpenter@oracle.com>

> Signed-off-by: Huang Rui <ray.huang@amd.com>

> ---

>  drivers/gpu/drm/amd/powerplay/amd_powerplay.c | 3 ++-

>  1 file changed, 2 insertions(+), 1 deletion(-)

> 

> diff --git a/drivers/gpu/drm/amd/powerplay/amd_powerplay.c

> b/drivers/gpu/drm/amd/powerplay/amd_powerplay.c

> index b493369..2d0e42f 100644

> --- a/drivers/gpu/drm/amd/powerplay/amd_powerplay.c

> +++ b/drivers/gpu/drm/amd/powerplay/amd_powerplay.c

> @@ -191,7 +191,8 @@ static int pp_late_init(void *handle)

>  	if (adev->pm.smu_prv_buffer_size != 0)

>  		pp_reserve_vram_for_smu(adev);

> 

> -	if (hwmgr->hwmgr_func->gfx_off_control &&

> +	if (hwmgr && hwmgr->hwmgr_func &&

> +	    hwmgr->hwmgr_func->gfx_off_control &&

>  	    (hwmgr->feature_mask & PP_GFXOFF_MASK)) {

>  		ret = hwmgr->hwmgr_func->gfx_off_control(hwmgr, true);

>  		if (ret)

> --

> 2.7.4

> 

> _______________________________________________

> amd-gfx mailing list

> amd-gfx@lists.freedesktop.org

> https://lists.freedesktop.org/mailman/listinfo/amd-gfx

> _______________________________________________

> amd-gfx mailing list

> amd-gfx@lists.freedesktop.org

> https://lists.freedesktop.org/mailman/listinfo/amd-gfx