From: Markus Elfring <elfr...@users.sourceforge.net>
Date: Sun, 18 Sep 2016 18:32:28 +0200
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit

* The script "checkpatch.pl" can point information out like the following.

  Comparison to NULL could be written !…

  Thus fix the affected source code places.

* Do also not use curly brackets at corresponding source code places
  where a single statement should be sufficient.

Signed-off-by: Markus Elfring <elfr...@users.sourceforge.net>
---
 drivers/gpu/drm/amd/amdgpu/amdgpu_device.c | 33 +++++++++++++++---------------
 1 file changed, 16 insertions(+), 17 deletions(-)

diff --git a/drivers/gpu/drm/amd/amdgpu/amdgpu_device.c 
b/drivers/gpu/drm/amd/amdgpu/amdgpu_device.c
index fed4854..b5b7cfb 100644
--- a/drivers/gpu/drm/amd/amdgpu/amdgpu_device.c
+++ b/drivers/gpu/drm/amd/amdgpu/amdgpu_device.c
@@ -251,7 +251,7 @@ static int amdgpu_vram_scratch_init(struct amdgpu_device 
*adev)
 {
        int r;
 
-       if (adev->vram_scratch.robj == NULL) {
+       if (!adev->vram_scratch.robj) {
                r = amdgpu_bo_create(adev, AMDGPU_GPU_PAGE_SIZE,
                                     PAGE_SIZE, true, AMDGPU_GEM_DOMAIN_VRAM,
                                     AMDGPU_GEM_CREATE_CPU_ACCESS_REQUIRED,
@@ -283,9 +283,9 @@ static void amdgpu_vram_scratch_fini(struct amdgpu_device 
*adev)
 {
        int r;
 
-       if (adev->vram_scratch.robj == NULL) {
+       if (!adev->vram_scratch.robj)
                return;
-       }
+
        r = amdgpu_bo_reserve(adev->vram_scratch.robj, false);
        if (likely(r == 0)) {
                amdgpu_bo_kunmap(adev->vram_scratch.robj);
@@ -359,9 +359,9 @@ static int amdgpu_doorbell_init(struct amdgpu_device *adev)
                return -EINVAL;
 
        adev->doorbell.ptr = ioremap(adev->doorbell.base, 
adev->doorbell.num_doorbells * sizeof(u32));
-       if (adev->doorbell.ptr == NULL) {
+       if (!adev->doorbell.ptr)
                return -ENOMEM;
-       }
+
        DRM_INFO("doorbell mmio base: 0x%08X\n", (uint32_t)adev->doorbell.base);
        DRM_INFO("doorbell mmio size: %u\n", (unsigned)adev->doorbell.size);
 
@@ -456,7 +456,7 @@ static int amdgpu_wb_init(struct amdgpu_device *adev)
 {
        int r;
 
-       if (adev->wb.wb_obj == NULL) {
+       if (!adev->wb.wb_obj) {
                r = amdgpu_bo_create(adev, AMDGPU_MAX_WB * 4, PAGE_SIZE, true,
                                     AMDGPU_GEM_DOMAIN_GTT, 0,  NULL, NULL,
                                     &adev->wb.wb_obj);
@@ -657,7 +657,7 @@ int amdgpu_dummy_page_init(struct amdgpu_device *adev)
        if (adev->dummy_page.page)
                return 0;
        adev->dummy_page.page = alloc_page(GFP_DMA32 | GFP_KERNEL | __GFP_ZERO);
-       if (adev->dummy_page.page == NULL)
+       if (!adev->dummy_page.page)
                return -ENOMEM;
        adev->dummy_page.addr = pci_map_page(adev->pdev, adev->dummy_page.page,
                                        0, PAGE_SIZE, PCI_DMA_BIDIRECTIONAL);
@@ -679,7 +679,7 @@ int amdgpu_dummy_page_init(struct amdgpu_device *adev)
  */
 void amdgpu_dummy_page_fini(struct amdgpu_device *adev)
 {
-       if (adev->dummy_page.page == NULL)
+       if (!adev->dummy_page.page)
                return;
        pci_unmap_page(adev->pdev, adev->dummy_page.addr,
                        PAGE_SIZE, PCI_DMA_BIDIRECTIONAL);
@@ -1226,10 +1226,10 @@ static int amdgpu_early_init(struct amdgpu_device *adev)
        adev->ip_block_status = kcalloc(adev->num_ip_blocks,
                                        sizeof(*adev->ip_block_status),
                                        GFP_KERNEL);
-       if (adev->ip_block_status == NULL)
+       if (!adev->ip_block_status)
                return -ENOMEM;
 
-       if (adev->ip_blocks == NULL) {
+       if (!adev->ip_blocks) {
                DRM_ERROR("No IP blocks found!\n");
                return r;
        }
@@ -1525,9 +1525,9 @@ int amdgpu_device_init(struct amdgpu_device *adev,
        adev->rmmio_base = pci_resource_start(adev->pdev, 5);
        adev->rmmio_size = pci_resource_len(adev->pdev, 5);
        adev->rmmio = ioremap(adev->rmmio_base, adev->rmmio_size);
-       if (adev->rmmio == NULL) {
+       if (!adev->rmmio)
                return -ENOMEM;
-       }
+
        DRM_INFO("register mmio base: 0x%08X\n", (uint32_t)adev->rmmio_base);
        DRM_INFO("register mmio size: %u\n", (unsigned)adev->rmmio_size);
 
@@ -1542,7 +1542,7 @@ int amdgpu_device_init(struct amdgpu_device *adev,
                        break;
                }
        }
-       if (adev->rio_mem == NULL)
+       if (!adev->rio_mem)
                DRM_ERROR("Unable to find PCI I/O BAR\n");
 
        /* early init functions */
@@ -1758,9 +1758,8 @@ int amdgpu_suspend_kms(struct drm_device *dev, bool 
suspend, bool fbcon)
        struct drm_connector *connector;
        int r;
 
-       if (dev == NULL || dev->dev_private == NULL) {
+       if (!dev || !dev->dev_private)
                return -ENODEV;
-       }
 
        adev = dev->dev_private;
 
@@ -1791,9 +1790,9 @@ int amdgpu_suspend_kms(struct drm_device *dev, bool 
suspend, bool fbcon)
                        }
                }
 
-               if (rfb == NULL || rfb->obj == NULL) {
+               if (!rfb || !rfb->obj)
                        continue;
-               }
+
                robj = gem_to_amdgpu_bo(rfb->obj);
                /* don't unpin kernel fb objects */
                if (!amdgpu_fbdev_robj_is_fb(adev, robj)) {
-- 
2.10.0

Reply via email to