[V2,6/6] drm/amd/powerplay: Fix potential NULL pointer issue

Submitted by Yu, Xiangliang on Dec. 2, 2016, 6:03 a.m.

Details

Message ID 1480658628-24446-7-git-send-email-Xiangliang.Yu@amd.com
State New
Headers show
Series "drm/amdgpu: add support SR-IOV initialization" ( rev: 3 2 ) in AMD X.Org drivers

Not browsing as part of any series.

Commit Message

Yu, Xiangliang Dec. 2, 2016, 6:03 a.m.
If doesn't enable dpm, the powerplay will not allocate memory for
hw management. So, hw_init_power_state_table function will reference
NULL pointer when resetting.

Signed-off-by: Xiangliang Yu <Xiangliang.Yu@amd.com>
---
 drivers/gpu/drm/amd/powerplay/amd_powerplay.c | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

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 51a3607..c81cf14 100644
--- a/drivers/gpu/drm/amd/powerplay/amd_powerplay.c
+++ b/drivers/gpu/drm/amd/powerplay/amd_powerplay.c
@@ -1004,12 +1004,12 @@  int amd_powerplay_reset(void *handle)
 	if (ret)
 		return ret;
 
-	hw_init_power_state_table(instance->hwmgr);
-
 	if ((amdgpu_dpm == 0)
 		|| cgs_is_virtualization_enabled(instance->smu_mgr->device))
 		return 0;
 
+	hw_init_power_state_table(instance->hwmgr);
+
 	if (eventmgr == NULL || eventmgr->pp_eventmgr_init == NULL)
 		return -EINVAL;
 

Comments

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

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

> Of Xiangliang Yu

> Sent: Friday, December 02, 2016 1:04 AM

> To: amd-gfx@lists.freedesktop.org

> Cc: Yu, Xiangliang

> Subject: [V2 6/6] drm/amd/powerplay: Fix potential NULL pointer issue

> 

> If doesn't enable dpm, the powerplay will not allocate memory for

> hw management. So, hw_init_power_state_table function will reference

> NULL pointer when resetting.

> 

> Signed-off-by: Xiangliang Yu <Xiangliang.Yu@amd.com>


Reviewed-by: Alex Deucher <alexander.deucher@amd.com>


> ---

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

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

> 

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

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

> index 51a3607..c81cf14 100644

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

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

> @@ -1004,12 +1004,12 @@ int amd_powerplay_reset(void *handle)

>  	if (ret)

>  		return ret;

> 

> -	hw_init_power_state_table(instance->hwmgr);

> -

>  	if ((amdgpu_dpm == 0)

>  		|| cgs_is_virtualization_enabled(instance->smu_mgr-

> >device))

>  		return 0;

> 

> +	hw_init_power_state_table(instance->hwmgr);

> +

>  	if (eventmgr == NULL || eventmgr->pp_eventmgr_init == NULL)

>  		return -EINVAL;

> 

> --

> 2.7.4

> 

> _______________________________________________

> amd-gfx mailing list

> amd-gfx@lists.freedesktop.org

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