path: root/drivers/gpu/drm/amd/powerplay/amd_powerplay.c
diff options
authorColin Ian King <>2019-12-12 18:16:57 +0000
committerAlex Deucher <>2019-12-18 16:09:05 -0500
commit63408972e4715ee03e470d9616e2b6aebd6f2595 (patch)
tree126e3c5cb63e58c5a50318fd42a33bb79bfc56dc /drivers/gpu/drm/amd/powerplay/amd_powerplay.c
parentb3eca59d998587b1930cb846910ec9824b9c2122 (diff)
drm/amd/powerplay: fix various dereferences of a pointer before it is null checked
There are several occurrances of the pointer hwmgr being dereferenced before it is null checked. Fix these by performing the dereference of hwmgr after it has been null checked. Addresses-Coverity: ("Dereference before null check") Fixes: c9ffa427db34e6 ("drm/amd/powerplay: enable pp one vf mode for vega10") Signed-off-by: Colin Ian King <> Signed-off-by: Alex Deucher <> Signed-off-by: Alex Deucher <>
Diffstat (limited to 'drivers/gpu/drm/amd/powerplay/amd_powerplay.c')
1 files changed, 3 insertions, 3 deletions
diff --git a/drivers/gpu/drm/amd/powerplay/amd_powerplay.c b/drivers/gpu/drm/amd/powerplay/amd_powerplay.c
index 5087d6bdba60..322c2015d3a0 100644
--- a/drivers/gpu/drm/amd/powerplay/amd_powerplay.c
+++ b/drivers/gpu/drm/amd/powerplay/amd_powerplay.c
@@ -275,12 +275,12 @@ static int pp_dpm_load_fw(void *handle)
struct pp_hwmgr *hwmgr = handle;
- if (!hwmgr->not_vf)
- return 0;
if (!hwmgr || !hwmgr->smumgr_funcs || !hwmgr->smumgr_funcs->start_smu)
return -EINVAL;
+ if (!hwmgr->not_vf)
+ return 0;
if (hwmgr->smumgr_funcs->start_smu(hwmgr)) {
pr_err("fw load failed\n");
return -EINVAL;