From: Heinrich Schuchardt Date: Sun, 21 Aug 2016 18:21:27 +0000 (+0200) Subject: drm/amd/powerplay: avoid NULL pointer dereference X-Git-Url: https://git.karo-electronics.de/?a=commitdiff_plain;h=d36f3e048e1e81906c776760d70e06bce366ef65;p=linux-beck.git drm/amd/powerplay: avoid NULL pointer dereference if (a == NULL || a->b == NULL) leads to a NULL pointer dereference if a == NULL. Reviewed-by: Christian König Signed-off-by: Heinrich Schuchardt Signed-off-by: Alex Deucher --- diff --git a/drivers/gpu/drm/amd/powerplay/amd_powerplay.c b/drivers/gpu/drm/amd/powerplay/amd_powerplay.c index 12d3333b9d12..2de34a5a85c2 100644 --- a/drivers/gpu/drm/amd/powerplay/amd_powerplay.c +++ b/drivers/gpu/drm/amd/powerplay/amd_powerplay.c @@ -163,12 +163,12 @@ static int pp_hw_fini(void *handle) pp_handle = (struct pp_instance *)handle; eventmgr = pp_handle->eventmgr; - if (eventmgr != NULL || eventmgr->pp_eventmgr_fini != NULL) + if (eventmgr != NULL && eventmgr->pp_eventmgr_fini != NULL) eventmgr->pp_eventmgr_fini(eventmgr); smumgr = pp_handle->smu_mgr; - if (smumgr != NULL || smumgr->smumgr_funcs != NULL || + if (smumgr != NULL && smumgr->smumgr_funcs != NULL && smumgr->smumgr_funcs->smu_fini != NULL) smumgr->smumgr_funcs->smu_fini(smumgr);