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

Christian König ckoenig.leichtzumerken at gmail.com
Mon Mar 12 12:54:59 UTC 2018


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;
> +				}
>   			}
>   		}
>   	}



More information about the amd-gfx mailing list