[PATCH] drm/amd/powerplay: avoid null pointer

Quan, Evan Evan.Quan at amd.com
Tue Dec 10 01:57:13 UTC 2019


Thanks. Reviewed-by: Evan Quan <evan.quan at amd.com>

> -----Original Message-----
> From: amd-gfx <amd-gfx-bounces at lists.freedesktop.org> On Behalf Of Yintian
> Tao
> Sent: Tuesday, December 10, 2019 1:27 AM
> To: Deucher, Alexander <Alexander.Deucher at amd.com>; Feng, Kenneth
> <Kenneth.Feng at amd.com>
> Cc: amd-gfx at lists.freedesktop.org; Tao, Yintian <Yintian.Tao at amd.com>
> Subject: [PATCH] drm/amd/powerplay: avoid null pointer
> 
> because some asics have no smu.ppt_funcs we need add one check for it
> otherwise it will raise null pointer problem.
> 
> Signed-off-by: Yintian Tao <yttao at amd.com>
> ---
>  drivers/gpu/drm/amd/amdgpu/amdgpu_pm.c | 3 ++-
>  1 file changed, 2 insertions(+), 1 deletion(-)
> 
> diff --git a/drivers/gpu/drm/amd/amdgpu/amdgpu_pm.c
> b/drivers/gpu/drm/amd/amdgpu/amdgpu_pm.c
> index a21ee035ca57..b8a42ebb2f5a 100644
> --- a/drivers/gpu/drm/amd/amdgpu/amdgpu_pm.c
> +++ b/drivers/gpu/drm/amd/amdgpu/amdgpu_pm.c
> @@ -160,7 +160,8 @@ static ssize_t amdgpu_get_dpm_state(struct device
> *dev,
>  	enum amd_pm_state_type pm;
> 
>  	if (is_support_sw_smu(adev)) {
> -		if (adev->smu.ppt_funcs->get_current_power_state)
> +		if (adev->smu.ppt_funcs &&
> +		    adev->smu.ppt_funcs->get_current_power_state)
>  			pm = smu_get_current_power_state(&adev->smu);
>  		else
>  			pm = adev->pm.dpm.user_state;
> --
> 2.17.1
> 
> _______________________________________________
> amd-gfx mailing list
> amd-gfx at lists.freedesktop.org
> https://nam11.safelinks.protection.outlook.com/?url=https%3A%2F%2Flists.free
> desktop.org%2Fmailman%2Flistinfo%2Famd-
> gfx&data=02%7C01%7Cevan.quan%40amd.com%7Cc3d9c9c42b8648b0c2
> d708d77cccf3f3%7C3dd8961fe4884e608e11a82d994e183d%7C0%7C0%7C6371
> 15092081521686&sdata=qDCT%2BPXFgCAu9GDTRpNjW890IVBEXuWMHx
> dN9OZZIsE%3D&reserved=0


More information about the amd-gfx mailing list