[PATCH 2/4] drm/amdgpu: Plus NULL function pointer check

Zhu, Rex Rex.Zhu at amd.com
Mon Mar 12 14:13:42 UTC 2018


Sure.

Thanks.


Best Regards

Rex


________________________________
From: Christian König <ckoenig.leichtzumerken at gmail.com>
Sent: Monday, March 12, 2018 8:54 PM
To: Zhu, Rex; amd-gfx at lists.freedesktop.org
Subject: Re: [PATCH 2/4] drm/amdgpu: Plus NULL function pointer check

Am 12.03.2018 um 13:34 schrieb Rex Zhu:
> Change-Id: Ifd6553646e7468bc935504075816074373e1d58d
> Signed-off-by: Rex Zhu <Rex.Zhu at amd.com>
> ---
>   drivers/gpu/drm/amd/amdgpu/amdgpu_device.c | 12 +++++++-----
>   1 file changed, 7 insertions(+), 5 deletions(-)
>
> diff --git a/drivers/gpu/drm/amd/amdgpu/amdgpu_device.c b/drivers/gpu/drm/amd/amdgpu/amdgpu_device.c
> index 56b2245..d60ecc5 100644
> --- a/drivers/gpu/drm/amd/amdgpu/amdgpu_device.c
> +++ b/drivers/gpu/drm/amd/amdgpu/amdgpu_device.c
> @@ -1415,12 +1415,14 @@ static int amdgpu_device_ip_late_set_cg_state(struct amdgpu_device *adev)
>                if (adev->ip_blocks[i].version->type != AMD_IP_BLOCK_TYPE_UVD &&
>                    adev->ip_blocks[i].version->type != AMD_IP_BLOCK_TYPE_VCE) {
>                        /* enable clockgating to save power */
> -                     r = adev->ip_blocks[i].version->funcs->set_clockgating_state((void *)adev,
> +                     if (adev->ip_blocks[i].version->funcs->set_clockgating_state) {

Why not add it to the if check above?

Christian.

> +                             r = adev->ip_blocks[i].version->funcs->set_clockgating_state((void *)adev,
>                                                                                     AMD_CG_STATE_GATE);
> -                     if (r) {
> -                             DRM_ERROR("set_clockgating_state(gate) of IP block <%s> failed %d\n",
> -                                       adev->ip_blocks[i].version->funcs->name, r);
> -                             return r;
> +                             if (r) {
> +                                     DRM_ERROR("set_clockgating_state(gate) of IP block <%s> failed %d\n",
> +                                             adev->ip_blocks[i].version->funcs->name, r);
> +                                     return r;
> +                             }
>                        }
>                }
>        }

-------------- next part --------------
An HTML attachment was scrubbed...
URL: <https://lists.freedesktop.org/archives/amd-gfx/attachments/20180312/055b60e8/attachment-0001.html>


More information about the amd-gfx mailing list