drm/amd/amdgpu : Fix NULL pointer comparison
authorRavikant B Sharma <ravikant.s2@samsung.com>
Tue, 8 Nov 2016 05:49:42 +0000 (11:19 +0530)
committerAlex Deucher <alexander.deucher@amd.com>
Fri, 11 Nov 2016 15:21:07 +0000 (10:21 -0500)
Replace direct comparisons to NULL i.e.
'x == NULL' with '!x'. As per coding standard.

Reviewed-by: Christian König <christian.koenig@amd.com>
Signed-off-by: Ravikant B Sharma <ravikant.s2@samsung.com>
Signed-off-by: Alex Deucher <alexander.deucher@amd.com>
drivers/gpu/drm/amd/amdgpu/amdgpu_bios.c
drivers/gpu/drm/amd/amdgpu/amdgpu_sa.c
drivers/gpu/drm/amd/amdgpu/gfx_v8_0.c

index 2b6afe123f3d90acce64b35325da1f1e9dbd1fa6..b7e2762fcdd2fd0cfa6c6d592eeded4500ab5f0e 100644 (file)
@@ -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;
        }
index 34a795463988bf16f57712d3a96d99afcabd87b7..de9f919ae33695a010eb67f8d1eda118ed5444de 100644 (file)
@@ -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);
index 1ac88b1fb1a15a5096724f7cda679db381af0164..ab84bff18727ae0ee16d9bf758e038ca025c2220 100644 (file)
@@ -3904,7 +3904,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);