drm/amd/powerplay: fix missed hwmgr check warning before call gfx_off_control handler
authorHuang Rui <ray.huang@amd.com>
Fri, 18 May 2018 02:39:16 +0000 (10:39 +0800)
committerAlex Deucher <alexander.deucher@amd.com>
Wed, 13 Jun 2018 18:45:21 +0000 (13:45 -0500)
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>
Reviewed-by: Evan Quan <evan.quan@amd.com>
Signed-off-by: Alex Deucher <alexander.deucher@amd.com>
drivers/gpu/drm/amd/powerplay/amd_powerplay.c

index d0e6e2dd6bc6d2392cc9e3aca3508a4c13bf9de6..0969b65003ed12a51fbbe4ee58878f6f9a068c8b 100644 (file)
@@ -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)