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

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



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



[Index of Archives]     [Linux USB Devel]     [Linux Audio Users]     [Yosemite News]     [Linux Kernel]     [Linux SCSI]

  Powered by Linux