drm/amdgpu: add checking to avoid null pointer without enabling powerplay

Submitted by Huang, Ray on Nov. 19, 2018, 7:52 a.m.

Details

Message ID 1542613970-22877-1-git-send-email-ray.huang@amd.com
State New
Headers show
Series "drm/amdgpu: add checking to avoid null pointer without enabling powerplay" ( rev: 1 ) in AMD X.Org drivers

Not browsing as part of any series.

Commit Message

Huang, Ray Nov. 19, 2018, 7:52 a.m.
This patch adds the checking to avoid null pointer reference while powerplay is
disbaled.

Signed-off-by: Huang Rui <ray.huang@amd.com>
Reviewed-by: Hawking Zhang <Hawking.Zhang@amd.com>
---
 drivers/gpu/drm/amd/amdgpu/amdgpu_device.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

Patch hide | download patch | download mbox

diff --git a/drivers/gpu/drm/amd/amdgpu/amdgpu_device.c b/drivers/gpu/drm/amd/amdgpu/amdgpu_device.c
index c96f670..b42163c 100644
--- a/drivers/gpu/drm/amd/amdgpu/amdgpu_device.c
+++ b/drivers/gpu/drm/amd/amdgpu/amdgpu_device.c
@@ -1668,7 +1668,7 @@  static int amdgpu_device_fw_loading(struct amdgpu_device *adev)
 		}
 	}
 
-	if (adev->powerplay.pp_funcs->load_firmware) {
+	if (adev->powerplay.pp_funcs && adev->powerplay.pp_funcs->load_firmware) {
 		r = adev->powerplay.pp_funcs->load_firmware(adev->powerplay.pp_handle);
 		if (r) {
 			pr_err("firmware loading failed\n");

Comments

> -----Original Message-----
> From: Huang Rui [mailto:ray.huang@amd.com]
> Sent: Monday, November 19, 2018 3:53 PM
> To: amd-gfx@lists.freedesktop.org
> Cc: Huang, Ray <Ray.Huang@amd.com>
> Subject: [PATCH] drm/amdgpu: add checking to avoid null pointer without
> enabling powerplay
> 
> This patch adds the checking to avoid null pointer reference while powerplay
> is disbaled.
> 
> Signed-off-by: Huang Rui <ray.huang@amd.com>
> Reviewed-by: Hawking Zhang <Hawking.Zhang@amd.com>

Sorry, please ignore this patch. The fix is already in staging.

Thanks,
Ray

> ---
>  drivers/gpu/drm/amd/amdgpu/amdgpu_device.c | 2 +-
>  1 file changed, 1 insertion(+), 1 deletion(-)
> 
> diff --git a/drivers/gpu/drm/amd/amdgpu/amdgpu_device.c
> b/drivers/gpu/drm/amd/amdgpu/amdgpu_device.c
> index c96f670..b42163c 100644
> --- a/drivers/gpu/drm/amd/amdgpu/amdgpu_device.c
> +++ b/drivers/gpu/drm/amd/amdgpu/amdgpu_device.c
> @@ -1668,7 +1668,7 @@ static int amdgpu_device_fw_loading(struct
> amdgpu_device *adev)
>  		}
>  	}
> 
> -	if (adev->powerplay.pp_funcs->load_firmware) {
> +	if (adev->powerplay.pp_funcs &&
> +adev->powerplay.pp_funcs->load_firmware) {
>  		r = adev->powerplay.pp_funcs->load_firmware(adev-
> >powerplay.pp_handle);
>  		if (r) {
>  			pr_err("firmware loading failed\n");
> --
> 2.7.4