[PATCH] drm/amd/amdgpu : Fix NULL pointer comparison

Christian König christian.koenig at amd.com
Tue Nov 8 07:52:32 UTC 2016


Am 08.11.2016 um 06:49 schrieb Ravikant Bijendra Sharma:
> From: Ravikant B Sharma <ravikant.s2 at samsung.com>
>
> Replace direct comparisons to NULL i.e.
> 'x == NULL' with '!x'. As per coding standard.
>
> Signed-off-by: Ravikant B Sharma <ravikant.s2 at samsung.com>

Please stop CCing random people who contributed to the driver in the 
past on something as trivial as this.

The maintainers of a driver (in this case Alex and me) should be 
perfectly sufficient.

Apart from that the patch is Reviewed-by: Christian König 
<christian.koenig at amd.com>.

Thanks,
Christian.

> ---
>   drivers/gpu/drm/amd/amdgpu/amdgpu_bios.c |    2 +-
>   drivers/gpu/drm/amd/amdgpu/amdgpu_sa.c   |    3 +--
>   drivers/gpu/drm/amd/amdgpu/gfx_v8_0.c    |    2 +-
>   3 files changed, 3 insertions(+), 4 deletions(-)
>
> diff --git a/drivers/gpu/drm/amd/amdgpu/amdgpu_bios.c b/drivers/gpu/drm/amd/amdgpu/amdgpu_bios.c
> index 2b6afe1..b7e2762 100644
> --- a/drivers/gpu/drm/amd/amdgpu/amdgpu_bios.c
> +++ b/drivers/gpu/drm/amd/amdgpu/amdgpu_bios.c
> @@ -70,7 +70,7 @@ static bool igp_read_bios_from_vram(struct amdgpu_device *adev)
>   		return false;
>   	}
>   	adev->bios = kmalloc(size, GFP_KERNEL);
> -	if (adev->bios == NULL) {
> +	if (!adev->bios) {
>   		iounmap(bios);
>   		return false;
>   	}
> diff --git a/drivers/gpu/drm/amd/amdgpu/amdgpu_sa.c b/drivers/gpu/drm/amd/amdgpu/amdgpu_sa.c
> index d8af37a..3ecb083 100644
> --- a/drivers/gpu/drm/amd/amdgpu/amdgpu_sa.c
> +++ b/drivers/gpu/drm/amd/amdgpu/amdgpu_sa.c
> @@ -327,9 +327,8 @@ int amdgpu_sa_bo_new(struct amdgpu_sa_manager *sa_manager,
>   		return -EINVAL;
>   
>   	*sa_bo = kmalloc(sizeof(struct amdgpu_sa_bo), GFP_KERNEL);
> -	if ((*sa_bo) == NULL) {
> +	if (!(*sa_bo))
>   		return -ENOMEM;
> -	}
>   	(*sa_bo)->manager = sa_manager;
>   	(*sa_bo)->fence = NULL;
>   	INIT_LIST_HEAD(&(*sa_bo)->olist);
> diff --git a/drivers/gpu/drm/amd/amdgpu/gfx_v8_0.c b/drivers/gpu/drm/amd/amdgpu/gfx_v8_0.c
> index ee6a48a..6c020ea7 100644
> --- a/drivers/gpu/drm/amd/amdgpu/gfx_v8_0.c
> +++ b/drivers/gpu/drm/amd/amdgpu/gfx_v8_0.c
> @@ -3905,7 +3905,7 @@ static int gfx_v8_0_init_save_restore_list(struct amdgpu_device *adev)
>   	int list_size;
>   	unsigned int *register_list_format =
>   		kmalloc(adev->gfx.rlc.reg_list_format_size_bytes, GFP_KERNEL);
> -	if (register_list_format == NULL)
> +	if (!register_list_format)
>   		return -ENOMEM;
>   	memcpy(register_list_format, adev->gfx.rlc.register_list_format,
>   			adev->gfx.rlc.reg_list_format_size_bytes);




More information about the amd-gfx mailing list