Skip to content

Commit

Permalink
drm/amd/powerplay: fix missed hwmgr check warning before call gfx_off…
Browse files Browse the repository at this point in the history
…_control handler

Patch 9667849: "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>
  • Loading branch information
Huang Rui authored and Alex Deucher committed Jun 13, 2018
1 parent 06b18f6 commit 7584498
Showing 1 changed file with 2 additions and 1 deletion.
3 changes: 2 additions & 1 deletion drivers/gpu/drm/amd/powerplay/amd_powerplay.c
Original file line number Diff line number Diff line change
Expand Up @@ -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)
Expand Down

0 comments on commit 7584498

Please sign in to comment.