[PATCH] drivers/amdgpu: Trim down some unnecessary braces

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

 



Indeed, I am going to probably revise this series with a few more cases
I found in the various patches. Its a pretty boring series so I rather
not drag it out too long though.

On 07/11/2016 04:19 PM, Alexandre Demers wrote:
> Some braces that you removed were there for readability purposes, mostly
> the ones where we are calling a function, returning a value or "goto"ing
> conditionally which get sandwiched with the following line without the
> braces. I'm not sure what others use as coding style, but I would at
> least add an empty space in such cases to keep readability.
> 
> Such an example where the "return" gets crushed between its condition
> and the following line one the braces are removes, thus loosing
> readability:
> 
> @@ -278,9 +277,8 @@ static void amdgpu_vram_scratch_fini(struct
> amdgpu_device *adev)
>  {
>      int r;
> 
> -    if (adev->vram_scratch.robj == NULL) {
> +    if (adev->vram_scratch.robj == NULL)
>          return;
> -    }
>      r = amdgpu_bo_reserve(adev->vram_scratch.robj, false);
>      if (likely(r == 0)) {
>          amdgpu_bo_kunmap(adev->vram_scratch.robj);
> 
> However, going through the code doesn't show a systematic coding style,
> here allowing sandwiches to happen, there adding an empty line instead
> of a closing brace to keep readability. Other than that, you have my
> Reviewed-by.
> 
> Alexandre Demers
> 
> On 2016-07-10 19:28, Edward O'Callaghan wrote:
>> By starting from the initial basic Coccinelle script:
>>
>>    @@
>>    statement S;
>>    @@
>>
>>    - {
>>    S
>>    - }
>>
>> then hand craft each hulk from there on..
>>
>> Signed-off-by: Edward O'Callaghan <funfunctor at folklore1984.net>
>> ---
>>   drivers/gpu/drm/amd/amdgpu/amdgpu_acpi.c      |  3 +--
>>   drivers/gpu/drm/amd/amdgpu/amdgpu_benchmark.c | 15 ++++-------
>>   drivers/gpu/drm/amd/amdgpu/amdgpu_bios.c      | 24 ++++++-----------
>>   drivers/gpu/drm/amd/amdgpu/amdgpu_cs.c        |  3 +--
>>   drivers/gpu/drm/amd/amdgpu/amdgpu_device.c    | 30
>> +++++++--------------
>>   drivers/gpu/drm/amd/amdgpu/amdgpu_display.c   | 14 ++++------
>>   drivers/gpu/drm/amd/amdgpu/amdgpu_fb.c        |  3 +--
>>   drivers/gpu/drm/amd/amdgpu/amdgpu_gart.c      | 15 ++++-------
>>   drivers/gpu/drm/amd/amdgpu/amdgpu_gem.c       | 15 ++++-------
>>   drivers/gpu/drm/amd/amdgpu/amdgpu_ib.c        | 12 +++------
>>   drivers/gpu/drm/amd/amdgpu/amdgpu_irq.c       |  6 ++---
>>   drivers/gpu/drm/amd/amdgpu/amdgpu_kms.c       |  3 +--
>>   drivers/gpu/drm/amd/amdgpu/amdgpu_object.c    |  6 ++---
>>   drivers/gpu/drm/amd/amdgpu/amdgpu_pm.c        |  7 +++--
>>   drivers/gpu/drm/amd/amdgpu/amdgpu_ring.c      |  6 ++---
>>   drivers/gpu/drm/amd/amdgpu/amdgpu_sa.c        | 18 +++++--------
>>   drivers/gpu/drm/amd/amdgpu/amdgpu_test.c      |  3 +--
>>   drivers/gpu/drm/amd/amdgpu/amdgpu_ttm.c       | 39
>> +++++++++------------------
>>   drivers/gpu/drm/amd/amdgpu/amdgpu_vce.c       |  5 ++--
>>   drivers/gpu/drm/amd/amdgpu/amdgpu_vm.c        |  3 +--
>>   drivers/gpu/drm/amd/amdgpu/ci_dpm.c           |  3 +--
>>   drivers/gpu/drm/amd/amdgpu/cik_sdma.c         |  5 ++--
>>   drivers/gpu/drm/amd/amdgpu/fiji_smc.c         |  2 --
>>   drivers/gpu/drm/amd/amdgpu/gmc_v7_0.c         | 11 +++-----
>>   drivers/gpu/drm/amd/amdgpu/gmc_v8_0.c         | 11 +++-----
>>   drivers/gpu/drm/amd/amdgpu/kv_dpm.c           | 11 +++-----
>>   drivers/gpu/drm/amd/amdgpu/sdma_v2_4.c        |  5 ++--
>>   drivers/gpu/drm/amd/amdgpu/sdma_v3_0.c        |  5 ++--
>>   drivers/gpu/drm/amd/amdgpu/tonga_smc.c        |  2 --
>>   29 files changed, 97 insertions(+), 188 deletions(-)
>>
>> diff --git a/drivers/gpu/drm/amd/amdgpu/amdgpu_acpi.c
>> b/drivers/gpu/drm/amd/amdgpu/amdgpu_acpi.c
>> index 5cd7b73..cd57425 100644
>> --- a/drivers/gpu/drm/amd/amdgpu/amdgpu_acpi.c
>> +++ b/drivers/gpu/drm/amd/amdgpu/amdgpu_acpi.c
>> @@ -640,9 +640,8 @@ int amdgpu_acpi_init(struct amdgpu_device *adev)
>>         /* Call the ATCS method */
>>       ret = amdgpu_atcs_verify_interface(handle, atcs);
>> -    if (ret) {
>> +    if (ret)
>>           DRM_DEBUG_DRIVER("Call to ATCS verify_interface failed:
>> %d\n", ret);
>> -    }
>>         /* Call the ATIF method */
>>       ret = amdgpu_atif_verify_interface(handle, atif);
>> diff --git a/drivers/gpu/drm/amd/amdgpu/amdgpu_benchmark.c
>> b/drivers/gpu/drm/amd/amdgpu/amdgpu_benchmark.c
>> index 33e47a4..7c8c190 100644
>> --- a/drivers/gpu/drm/amd/amdgpu/amdgpu_benchmark.c
>> +++ b/drivers/gpu/drm/amd/amdgpu/amdgpu_benchmark.c
>> @@ -81,30 +81,26 @@ static void amdgpu_benchmark_move(struct
>> amdgpu_device *adev, unsigned size,
>>       n = AMDGPU_BENCHMARK_ITERATIONS;
>>       r = amdgpu_bo_create(adev, size, PAGE_SIZE, true, sdomain, 0, NULL,
>>                    NULL, &sobj);
>> -    if (r) {
>> +    if (r)
>>           goto out_cleanup;
>> -    }
>>       r = amdgpu_bo_reserve(sobj, false);
>>       if (unlikely(r != 0))
>>           goto out_cleanup;
>>       r = amdgpu_bo_pin(sobj, sdomain, &saddr);
>>       amdgpu_bo_unreserve(sobj);
>> -    if (r) {
>> +    if (r)
>>           goto out_cleanup;
>> -    }
>>       r = amdgpu_bo_create(adev, size, PAGE_SIZE, true, ddomain, 0, NULL,
>>                    NULL, &dobj);
>> -    if (r) {
>> +    if (r)
>>           goto out_cleanup;
>> -    }
>>       r = amdgpu_bo_reserve(dobj, false);
>>       if (unlikely(r != 0))
>>           goto out_cleanup;
>>       r = amdgpu_bo_pin(dobj, ddomain, &daddr);
>>       amdgpu_bo_unreserve(dobj);
>> -    if (r) {
>> +    if (r)
>>           goto out_cleanup;
>> -    }
>>         if (adev->mman.buffer_funcs) {
>>           time = amdgpu_benchmark_do_move(adev, size, saddr, daddr, n);
>> @@ -133,9 +129,8 @@ out_cleanup:
>>           amdgpu_bo_unref(&dobj);
>>       }
>>   -    if (r) {
>> +    if (r)
>>           DRM_ERROR("Error while benchmarking BO move.\n");
>> -    }
>>   }
>>     void amdgpu_benchmark(struct amdgpu_device *adev, int test_number)
>> diff --git a/drivers/gpu/drm/amd/amdgpu/amdgpu_bios.c
>> b/drivers/gpu/drm/amd/amdgpu/amdgpu_bios.c
>> index 2b6afe1..ca22698 100644
>> --- a/drivers/gpu/drm/amd/amdgpu/amdgpu_bios.c
>> +++ b/drivers/gpu/drm/amd/amdgpu/amdgpu_bios.c
>> @@ -61,9 +61,8 @@ static bool igp_read_bios_from_vram(struct
>> amdgpu_device *adev)
>>       adev->bios = NULL;
>>       vram_base = pci_resource_start(adev->pdev, 0);
>>       bios = ioremap(vram_base, size);
>> -    if (!bios) {
>> +    if (!bios)
>>           return false;
>> -    }
>>         if (size == 0 || !AMD_IS_VALID_VBIOS(bios)) {
>>           iounmap(bios);
>> @@ -87,9 +86,8 @@ bool amdgpu_read_bios(struct amdgpu_device *adev)
>>       adev->bios = NULL;
>>       /* XXX: some cards may return 0 for rom size? ddx has a
>> workaround */
>>       bios = pci_map_rom(adev->pdev, &size);
>> -    if (!bios) {
>> +    if (!bios)
>>           return false;
>> -    }
>>         val[0] = readb(&bios[0]);
>>       val[1] = readb(&bios[1]);
>> @@ -148,17 +146,14 @@ static bool amdgpu_read_platform_bios(struct
>> amdgpu_device *adev)
>>       adev->bios = NULL;
>>         bios = pci_platform_rom(adev->pdev, &size);
>> -    if (!bios) {
>> +    if (!bios)
>>           return false;
>> -    }
>>   -    if (size == 0 || !AMD_IS_VALID_VBIOS(bios)) {
>> +    if (size == 0 || !AMD_IS_VALID_VBIOS(bios))
>>           return false;
>> -    }
>>       adev->bios = kmemdup(bios, size, GFP_KERNEL);
>> -    if (adev->bios == NULL) {
>> +    if (adev->bios == NULL)
>>           return false;
>> -    }
>>         return true;
>>   }
>> @@ -358,15 +353,12 @@ bool amdgpu_get_bios(struct amdgpu_device *adev)
>>           r = igp_read_bios_from_vram(adev);
>>       if (!r)
>>           r = amdgpu_read_bios(adev);
>> -    if (!r) {
>> +    if (!r)
>>           r = amdgpu_read_bios_from_rom(adev);
>> -    }
>> -    if (!r) {
>> +    if (!r)
>>           r = amdgpu_read_disabled_bios(adev);
>> -    }
>> -    if (!r) {
>> +    if (!r)
>>           r = amdgpu_read_platform_bios(adev);
>> -    }
>>       if (!r || adev->bios == NULL) {
>>           DRM_ERROR("Unable to locate a BIOS ROM\n");
>>           adev->bios = NULL;
>> diff --git a/drivers/gpu/drm/amd/amdgpu/amdgpu_cs.c
>> b/drivers/gpu/drm/amd/amdgpu/amdgpu_cs.c
>> index 9bc8f1d..1b96345 100644
>> --- a/drivers/gpu/drm/amd/amdgpu/amdgpu_cs.c
>> +++ b/drivers/gpu/drm/amd/amdgpu/amdgpu_cs.c
>> @@ -730,9 +730,8 @@ static int amdgpu_cs_ib_fill(struct amdgpu_device
>> *adev,
>>                 /* the IB should be reserved at this point */
>>               r = amdgpu_bo_kmap(aobj, (void **)&kptr);
>> -            if (r) {
>> +            if (r)
>>                   return r;
>> -            }
>>                 offset = ((uint64_t)m->it.start) * AMDGPU_GPU_PAGE_SIZE;
>>               kptr += chunk_ib->va_start - offset;
>> diff --git a/drivers/gpu/drm/amd/amdgpu/amdgpu_device.c
>> b/drivers/gpu/drm/amd/amdgpu/amdgpu_device.c
>> index 6e92008..bd13d58 100644
>> --- a/drivers/gpu/drm/amd/amdgpu/amdgpu_device.c
>> +++ b/drivers/gpu/drm/amd/amdgpu/amdgpu_device.c
>> @@ -251,9 +251,8 @@ static int amdgpu_vram_scratch_init(struct
>> amdgpu_device *adev)
>>                        PAGE_SIZE, true, AMDGPU_GEM_DOMAIN_VRAM,
>>                        AMDGPU_GEM_CREATE_CPU_ACCESS_REQUIRED,
>>                        NULL, NULL, &adev->vram_scratch.robj);
>> -        if (r) {
>> +        if (r)
>>               return r;
>> -        }
>>       }
>>         r = amdgpu_bo_reserve(adev->vram_scratch.robj, false);
>> @@ -278,9 +277,8 @@ static void amdgpu_vram_scratch_fini(struct
>> amdgpu_device *adev)
>>   {
>>       int r;
>>   -    if (adev->vram_scratch.robj == NULL) {
>> +    if (adev->vram_scratch.robj == NULL)
>>           return;
>> -    }
>>       r = amdgpu_bo_reserve(adev->vram_scratch.robj, false);
>>       if (likely(r == 0)) {
>>           amdgpu_bo_kunmap(adev->vram_scratch.robj);
>> @@ -354,9 +352,8 @@ 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 == NULL)
>>           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);
>>   @@ -1342,9 +1339,8 @@ static int amdgpu_suspend(struct amdgpu_device
>> *adev)
>>       /* ungate SMC block first */
>>       r = amdgpu_set_clockgating_state(adev, AMD_IP_BLOCK_TYPE_SMC,
>>                        AMD_CG_STATE_UNGATE);
>> -    if (r) {
>> +    if (r)
>>           DRM_ERROR("set_clockgating_state(ungate) SMC failed %d\n",r);
>> -    }
>>         for (i = adev->num_ip_blocks - 1; i >= 0; i--) {
>>           if (!adev->ip_block_status[i].valid)
>> @@ -1472,9 +1468,8 @@ 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 == NULL)
>>           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);
>>   @@ -1585,14 +1580,12 @@ int amdgpu_device_init(struct amdgpu_device
>> *adev,
>>           DRM_ERROR("ib ring test failed (%d).\n", r);
>>         r = amdgpu_gem_debugfs_init(adev);
>> -    if (r) {
>> +    if (r)
>>           DRM_ERROR("registering gem debugfs failed (%d).\n", r);
>> -    }
>>         r = amdgpu_debugfs_regs_init(adev);
>> -    if (r) {
>> +    if (r)
>>           DRM_ERROR("registering register debugfs failed (%d).\n", r);
>> -    }
>>         if ((amdgpu_testing & 1)) {
>>           if (adev->accel_working)
>> @@ -1688,9 +1681,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 == NULL || dev->dev_private == NULL)
>>           return -ENODEV;
>> -    }
>>         adev = dev->dev_private;
>>   @@ -1721,9 +1713,8 @@ int amdgpu_suspend_kms(struct drm_device *dev,
>> bool suspend, bool fbcon)
>>               }
>>           }
>>   -        if (rfb == NULL || rfb->obj == NULL) {
>> +        if (rfb == NULL || rfb->obj == NULL)
>>               continue;
>> -        }
>>           robj = gem_to_amdgpu_bo(rfb->obj);
>>           /* don't unpin kernel fb objects */
>>           if (!amdgpu_fbdev_robj_is_fb(adev, robj)) {
>> @@ -1778,9 +1769,8 @@ int amdgpu_resume_kms(struct drm_device *dev,
>> bool resume, bool fbcon)
>>       if (dev->switch_power_state == DRM_SWITCH_POWER_OFF)
>>           return 0;
>>   -    if (fbcon) {
>> +    if (fbcon)
>>           console_lock();
>> -    }
>>       if (resume) {
>>           pci_set_power_state(dev->pdev, PCI_D0);
>>           pci_restore_state(dev->pdev);
>> diff --git a/drivers/gpu/drm/amd/amdgpu/amdgpu_display.c
>> b/drivers/gpu/drm/amd/amdgpu/amdgpu_display.c
>> index f518c10..9250f98 100644
>> --- a/drivers/gpu/drm/amd/amdgpu/amdgpu_display.c
>> +++ b/drivers/gpu/drm/amd/amdgpu/amdgpu_display.c
>> @@ -157,9 +157,8 @@ static void amdgpu_unpin_work_func(struct
>> work_struct *__work)
>>       r = amdgpu_bo_reserve(work->old_rbo, false);
>>       if (likely(r == 0)) {
>>           r = amdgpu_bo_unpin(work->old_rbo);
>> -        if (unlikely(r != 0)) {
>> +        if (unlikely(r != 0))
>>               DRM_ERROR("failed to unpin buffer after flip\n");
>> -        }
>>           amdgpu_bo_unreserve(work->old_rbo);
>>       } else
>>           DRM_ERROR("failed to reserve buffer after flip\n");
>> @@ -275,9 +274,8 @@ pflip_cleanup:
>>           DRM_ERROR("failed to reserve new rbo in error path\n");
>>           goto cleanup;
>>       }
>> -    if (unlikely(amdgpu_bo_unpin(new_rbo) != 0)) {
>> +    if (unlikely(amdgpu_bo_unpin(new_rbo) != 0))
>>           DRM_ERROR("failed to unpin new rbo in error path\n");
>> -    }
>>       amdgpu_bo_unreserve(new_rbo);
>>     cleanup:
>> @@ -490,11 +488,10 @@ bool amdgpu_ddc_probe(struct amdgpu_connector
>> *amdgpu_connector,
>>       if (amdgpu_connector->router.ddc_valid)
>>           amdgpu_i2c_router_select_ddc_port(amdgpu_connector);
>>   -    if (use_aux) {
>> +    if (use_aux)
>>           ret = i2c_transfer(&amdgpu_connector->ddc_bus->aux.ddc,
>> msgs, 2);
>> -    } else {
>> +    else
>>           ret = i2c_transfer(&amdgpu_connector->ddc_bus->adapter,
>> msgs, 2);
>> -    }
>>         if (ret != 2)
>>           /* Couldn't find an accessible DDC on this connector */
>> @@ -516,9 +513,8 @@ static void amdgpu_user_framebuffer_destroy(struct
>> drm_framebuffer *fb)
>>   {
>>       struct amdgpu_framebuffer *amdgpu_fb = to_amdgpu_framebuffer(fb);
>>   -    if (amdgpu_fb->obj) {
>> +    if (amdgpu_fb->obj)
>>           drm_gem_object_unreference_unlocked(amdgpu_fb->obj);
>> -    }
>>       drm_framebuffer_cleanup(fb);
>>       kfree(amdgpu_fb);
>>   }
>> diff --git a/drivers/gpu/drm/amd/amdgpu/amdgpu_fb.c
>> b/drivers/gpu/drm/amd/amdgpu/amdgpu_fb.c
>> index 9191467..ae93546 100644
>> --- a/drivers/gpu/drm/amd/amdgpu/amdgpu_fb.c
>> +++ b/drivers/gpu/drm/amd/amdgpu/amdgpu_fb.c
>> @@ -156,9 +156,8 @@ static int amdgpufb_create_pinned_object(struct
>> amdgpu_fbdev *rfbdev,
>>       }
>>       ret = amdgpu_bo_kmap(rbo, NULL);
>>       amdgpu_bo_unreserve(rbo);
>> -    if (ret) {
>> +    if (ret)
>>           goto out_unref;
>> -    }
>>         *gobj_p = gobj;
>>       return 0;
>> diff --git a/drivers/gpu/drm/amd/amdgpu/amdgpu_gart.c
>> b/drivers/gpu/drm/amd/amdgpu/amdgpu_gart.c
>> index 921bce2..b468f8e 100644
>> --- a/drivers/gpu/drm/amd/amdgpu/amdgpu_gart.c
>> +++ b/drivers/gpu/drm/amd/amdgpu/amdgpu_gart.c
>> @@ -68,9 +68,8 @@ int amdgpu_gart_table_ram_alloc(struct amdgpu_device
>> *adev)
>>         ptr = pci_alloc_consistent(adev->pdev, adev->gart.table_size,
>>                      &adev->gart.table_addr);
>> -    if (ptr == NULL) {
>> +    if (ptr == NULL)
>>           return -ENOMEM;
>> -    }
>>   #ifdef CONFIG_X86
>>       if (0) {
>>           set_memory_uc((unsigned long)ptr,
>> @@ -93,9 +92,8 @@ int amdgpu_gart_table_ram_alloc(struct amdgpu_device
>> *adev)
>>    */
>>   void amdgpu_gart_table_ram_free(struct amdgpu_device *adev)
>>   {
>> -    if (adev->gart.ptr == NULL) {
>> +    if (adev->gart.ptr == NULL)
>>           return;
>> -    }
>>   #ifdef CONFIG_X86
>>       if (0) {
>>           set_memory_wb((unsigned long)adev->gart.ptr,
>> @@ -128,9 +126,8 @@ int amdgpu_gart_table_vram_alloc(struct
>> amdgpu_device *adev)
>>                        PAGE_SIZE, true, AMDGPU_GEM_DOMAIN_VRAM,
>>                        AMDGPU_GEM_CREATE_CPU_ACCESS_REQUIRED,
>>                        NULL, NULL, &adev->gart.robj);
>> -        if (r) {
>> +        if (r)
>>               return r;
>> -        }
>>       }
>>       return 0;
>>   }
>> @@ -179,9 +176,8 @@ void amdgpu_gart_table_vram_unpin(struct
>> amdgpu_device *adev)
>>   {
>>       int r;
>>   -    if (adev->gart.robj == NULL) {
>> +    if (adev->gart.robj == NULL)
>>           return;
>> -    }
>>       r = amdgpu_bo_reserve(adev->gart.robj, false);
>>       if (likely(r == 0)) {
>>           amdgpu_bo_kunmap(adev->gart.robj);
>> @@ -202,9 +198,8 @@ void amdgpu_gart_table_vram_unpin(struct
>> amdgpu_device *adev)
>>    */
>>   void amdgpu_gart_table_vram_free(struct amdgpu_device *adev)
>>   {
>> -    if (adev->gart.robj == NULL) {
>> +    if (adev->gart.robj == NULL)
>>           return;
>> -    }
>>       amdgpu_bo_unref(&adev->gart.robj);
>>   }
>>   diff --git a/drivers/gpu/drm/amd/amdgpu/amdgpu_gem.c
>> b/drivers/gpu/drm/amd/amdgpu/amdgpu_gem.c
>> index 8fab648..d9edaff 100644
>> --- a/drivers/gpu/drm/amd/amdgpu/amdgpu_gem.c
>> +++ b/drivers/gpu/drm/amd/amdgpu/amdgpu_gem.c
>> @@ -54,9 +54,8 @@ int amdgpu_gem_object_create(struct amdgpu_device
>> *adev, unsigned long size,
>>         *obj = NULL;
>>       /* At least align on page size */
>> -    if (alignment < PAGE_SIZE) {
>> +    if (alignment < PAGE_SIZE)
>>           alignment = PAGE_SIZE;
>> -    }
>>         if (!(initial_domain & (AMDGPU_GEM_DOMAIN_GDS |
>> AMDGPU_GEM_DOMAIN_GWS | AMDGPU_GEM_DOMAIN_OA))) {
>>           /* Maximum bo size is the unpinned gtt size since we use the
>> gtt to
>> @@ -339,9 +338,8 @@ int amdgpu_mode_dumb_mmap(struct drm_file *filp,
>>       struct amdgpu_bo *robj;
>>         gobj = drm_gem_object_lookup(filp, handle);
>> -    if (gobj == NULL) {
>> +    if (gobj == NULL)
>>           return -ENOENT;
>> -    }
>>       robj = gem_to_amdgpu_bo(gobj);
>>       if (amdgpu_ttm_tt_get_usermm(robj->tbo.ttm) ||
>>           (robj->flags & AMDGPU_GEM_CREATE_NO_CPU_ACCESS)) {
>> @@ -403,9 +401,8 @@ int amdgpu_gem_wait_idle_ioctl(struct drm_device
>> *dev, void *data,
>>       long ret;
>>         gobj = drm_gem_object_lookup(filp, handle);
>> -    if (gobj == NULL) {
>> +    if (gobj == NULL)
>>           return -ENOENT;
>> -    }
>>       robj = gem_to_amdgpu_bo(gobj);
>>       if (timeout == 0)
>>           ret = reservation_object_test_signaled_rcu(robj->tbo.resv,
>> true);
>> @@ -647,9 +644,8 @@ int amdgpu_gem_op_ioctl(struct drm_device *dev,
>> void *data,
>>       int r;
>>         gobj = drm_gem_object_lookup(filp, args->handle);
>> -    if (gobj == NULL) {
>> +    if (gobj == NULL)
>>           return -ENOENT;
>> -    }
>>       robj = gem_to_amdgpu_bo(gobj);
>>         r = amdgpu_bo_reserve(robj, false);
>> @@ -719,9 +715,8 @@ int amdgpu_mode_dumb_create(struct drm_file
>> *file_priv,
>>       r = drm_gem_handle_create(file_priv, gobj, &handle);
>>       /* drop reference from allocate - handle holds it now */
>>       drm_gem_object_unreference_unlocked(gobj);
>> -    if (r) {
>> +    if (r)
>>           return r;
>> -    }
>>       args->handle = handle;
>>       return 0;
>>   }
>> diff --git a/drivers/gpu/drm/amd/amdgpu/amdgpu_ib.c
>> b/drivers/gpu/drm/amd/amdgpu/amdgpu_ib.c
>> index 34e3542..5fc3fce 100644
>> --- a/drivers/gpu/drm/amd/amdgpu/amdgpu_ib.c
>> +++ b/drivers/gpu/drm/amd/amdgpu/amdgpu_ib.c
>> @@ -235,26 +235,22 @@ int amdgpu_ib_pool_init(struct amdgpu_device *adev)
>>   {
>>       int r;
>>   -    if (adev->ib_pool_ready) {
>> +    if (adev->ib_pool_ready)
>>           return 0;
>> -    }
>>       r = amdgpu_sa_bo_manager_init(adev, &adev->ring_tmp_bo,
>>                         AMDGPU_IB_POOL_SIZE*64*1024,
>>                         AMDGPU_GPU_PAGE_SIZE,
>>                         AMDGPU_GEM_DOMAIN_GTT);
>> -    if (r) {
>> +    if (r)
>>           return r;
>> -    }
>>         r = amdgpu_sa_bo_manager_start(adev, &adev->ring_tmp_bo);
>> -    if (r) {
>> +    if (r)
>>           return r;
>> -    }
>>         adev->ib_pool_ready = true;
>> -    if (amdgpu_debugfs_sa_init(adev)) {
>> +    if (amdgpu_debugfs_sa_init(adev))
>>           dev_err(adev->dev, "failed to register debugfs file for SA\n");
>> -    }
>>       return 0;
>>   }
>>   diff --git a/drivers/gpu/drm/amd/amdgpu/amdgpu_irq.c
>> b/drivers/gpu/drm/amd/amdgpu/amdgpu_irq.c
>> index 835a3fa..2f4dca6a 100644
>> --- a/drivers/gpu/drm/amd/amdgpu/amdgpu_irq.c
>> +++ b/drivers/gpu/drm/amd/amdgpu/amdgpu_irq.c
>> @@ -156,9 +156,8 @@ void amdgpu_irq_uninstall(struct drm_device *dev)
>>   {
>>       struct amdgpu_device *adev = dev->dev_private;
>>   -    if (adev == NULL) {
>> +    if (adev == NULL)
>>           return;
>> -    }
>>       amdgpu_irq_disable_all(adev);
>>   }
>>   @@ -216,9 +215,8 @@ int amdgpu_irq_init(struct amdgpu_device *adev)
>>         spin_lock_init(&adev->irq.lock);
>>       r = drm_vblank_init(adev->ddev, adev->mode_info.num_crtc);
>> -    if (r) {
>> +    if (r)
>>           return r;
>> -    }
>>         /* enable msi */
>>       adev->irq.msi_enabled = false;
>> diff --git a/drivers/gpu/drm/amd/amdgpu/amdgpu_kms.c
>> b/drivers/gpu/drm/amd/amdgpu/amdgpu_kms.c
>> index d851ea1..9ee8264 100644
>> --- a/drivers/gpu/drm/amd/amdgpu/amdgpu_kms.c
>> +++ b/drivers/gpu/drm/amd/amdgpu/amdgpu_kms.c
>> @@ -89,9 +89,8 @@ int amdgpu_driver_load_kms(struct drm_device *dev,
>> unsigned long flags)
>>       int r, acpi_status;
>>         adev = kzalloc(sizeof(struct amdgpu_device), GFP_KERNEL);
>> -    if (adev == NULL) {
>> +    if (adev == NULL)
>>           return -ENOMEM;
>> -    }
>>       dev->dev_private = (void *)adev;
>>         if ((amdgpu_runtime_pm != 0) &&
>> diff --git a/drivers/gpu/drm/amd/amdgpu/amdgpu_object.c
>> b/drivers/gpu/drm/amd/amdgpu/amdgpu_object.c
>> index 7ecea83..6f38b67 100644
>> --- a/drivers/gpu/drm/amd/amdgpu/amdgpu_object.c
>> +++ b/drivers/gpu/drm/amd/amdgpu/amdgpu_object.c
>> @@ -274,9 +274,8 @@ int amdgpu_bo_create_restricted(struct
>> amdgpu_device *adev,
>>       r = ttm_bo_init(&adev->mman.bdev, &bo->tbo, size, type,
>>               &bo->placement, page_align, !kernel, NULL,
>>               acc_size, sg, resv, &amdgpu_ttm_bo_destroy);
>> -    if (unlikely(r != 0)) {
>> +    if (unlikely(r != 0))
>>           return r;
>> -    }
>>       *bo_ptr = bo;
>>         trace_amdgpu_bo_create(bo);
>> @@ -314,9 +313,8 @@ int amdgpu_bo_kmap(struct amdgpu_bo *bo, void **ptr)
>>           return -EPERM;
>>         if (bo->kptr) {
>> -        if (ptr) {
>> +        if (ptr)
>>               *ptr = bo->kptr;
>> -        }
>>           return 0;
>>       }
>>   diff --git a/drivers/gpu/drm/amd/amdgpu/amdgpu_pm.c
>> b/drivers/gpu/drm/amd/amdgpu/amdgpu_pm.c
>> index 0e13d80..8eef9e8 100644
>> --- a/drivers/gpu/drm/amd/amdgpu/amdgpu_pm.c
>> +++ b/drivers/gpu/drm/amd/amdgpu/amdgpu_pm.c
>> @@ -60,9 +60,9 @@ static ssize_t amdgpu_get_dpm_state(struct device *dev,
>>       struct amdgpu_device *adev = ddev->dev_private;
>>       enum amd_pm_state_type pm;
>>   -    if (adev->pp_enabled) {
>> +    if (adev->pp_enabled)
>>           pm = amdgpu_dpm_get_current_power_state(adev);
>> -    } else
>> +    else
>>           pm = adev->pm.dpm.user_state;
>>         return snprintf(buf, PAGE_SIZE, "%s\n",
>> @@ -315,9 +315,8 @@ static ssize_t amdgpu_get_pp_table(struct device
>> *dev,
>>       if (size >= PAGE_SIZE)
>>           size = PAGE_SIZE - 1;
>>   -    for (i = 0; i < size; i++) {
>> +    for (i = 0; i < size; i++)
>>           sprintf(buf + i, "%02x", table[i]);
>> -    }
>>       sprintf(buf + i, "\n");
>>         return size;
>> diff --git a/drivers/gpu/drm/amd/amdgpu/amdgpu_ring.c
>> b/drivers/gpu/drm/amd/amdgpu/amdgpu_ring.c
>> index 870f949..c4abc05 100644
>> --- a/drivers/gpu/drm/amd/amdgpu/amdgpu_ring.c
>> +++ b/drivers/gpu/drm/amd/amdgpu/amdgpu_ring.c
>> @@ -202,9 +202,8 @@ int amdgpu_ring_restore(struct amdgpu_ring *ring,
>>       if (r)
>>           return r;
>>   -    for (i = 0; i < size; ++i) {
>> +    for (i = 0; i < size; ++i)
>>           amdgpu_ring_write(ring, data[i]);
>> -    }
>>         amdgpu_ring_commit(ring);
>>       kfree(data);
>> @@ -319,9 +318,8 @@ int amdgpu_ring_init(struct amdgpu_device *adev,
>> struct amdgpu_ring *ring,
>>       ring->ptr_mask = (ring->ring_size / 4) - 1;
>>       ring->max_dw = max_dw;
>>   -    if (amdgpu_debugfs_ring_init(adev, ring)) {
>> +    if (amdgpu_debugfs_ring_init(adev, ring))
>>           DRM_ERROR("Failed to register debugfs file for rings !\n");
>> -    }
>>       return 0;
>>   }
>>   diff --git a/drivers/gpu/drm/amd/amdgpu/amdgpu_sa.c
>> b/drivers/gpu/drm/amd/amdgpu/amdgpu_sa.c
>> index 48618ee..25803ad 100644
>> --- a/drivers/gpu/drm/amd/amdgpu/amdgpu_sa.c
>> +++ b/drivers/gpu/drm/amd/amdgpu/amdgpu_sa.c
>> @@ -172,9 +172,8 @@ static inline unsigned
>> amdgpu_sa_bo_hole_soffset(struct amdgpu_sa_manager *sa_ma
>>   {
>>       struct list_head *hole = sa_manager->hole;
>>   -    if (hole != &sa_manager->olist) {
>> +    if (hole != &sa_manager->olist)
>>           return list_entry(hole, struct amdgpu_sa_bo, olist)->eoffset;
>> -    }
>>       return 0;
>>   }
>>   @@ -182,9 +181,8 @@ static inline unsigned
>> amdgpu_sa_bo_hole_eoffset(struct amdgpu_sa_manager *sa_ma
>>   {
>>       struct list_head *hole = sa_manager->hole;
>>   -    if (hole->next != &sa_manager->olist) {
>> +    if (hole->next != &sa_manager->olist)
>>           return list_entry(hole->next, struct amdgpu_sa_bo,
>> olist)->soffset;
>> -    }
>>       return sa_manager->size;
>>   }
>>   @@ -236,9 +234,8 @@ static bool amdgpu_sa_event(struct
>> amdgpu_sa_manager *sa_manager,
>>       eoffset = amdgpu_sa_bo_hole_eoffset(sa_manager);
>>       wasted = (align - (soffset % align)) % align;
>>   -    if ((eoffset - soffset) >= (size + wasted)) {
>> +    if ((eoffset - soffset) >= (size + wasted))
>>           return true;
>> -    }
>>         return false;
>>   }
>> @@ -278,9 +275,8 @@ static bool amdgpu_sa_bo_next_hole(struct
>> amdgpu_sa_manager *sa_manager,
>>           }
>>             /* limit the number of tries each ring gets */
>> -        if (tries[i] > 2) {
>> +        if (tries[i] > 2)
>>               continue;
>> -        }
>>             tmp = sa_bo->soffset;
>>           if (tmp < soffset) {
>> @@ -327,9 +323,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) == NULL)
>>           return -ENOMEM;
>> -    }
>>       (*sa_bo)->manager = sa_manager;
>>       (*sa_bo)->fence = NULL;
>>       INIT_LIST_HEAD(&(*sa_bo)->olist);
>> @@ -388,9 +383,8 @@ void amdgpu_sa_bo_free(struct amdgpu_device *adev,
>> struct amdgpu_sa_bo **sa_bo,
>>   {
>>       struct amdgpu_sa_manager *sa_manager;
>>   -    if (sa_bo == NULL || *sa_bo == NULL) {
>> +    if (sa_bo == NULL || *sa_bo == NULL)
>>           return;
>> -    }
>>         sa_manager = (*sa_bo)->manager;
>>       spin_lock(&sa_manager->wq.lock);
>> diff --git a/drivers/gpu/drm/amd/amdgpu/amdgpu_test.c
>> b/drivers/gpu/drm/amd/amdgpu/amdgpu_test.c
>> index 05a53f4..5bd4902 100644
>> --- a/drivers/gpu/drm/amd/amdgpu/amdgpu_test.c
>> +++ b/drivers/gpu/drm/amd/amdgpu/amdgpu_test.c
>> @@ -227,9 +227,8 @@ out_unref:
>>       amdgpu_bo_unref(&vram_obj);
>>   out_cleanup:
>>       kfree(gtt_obj);
>> -    if (r) {
>> +    if (r)
>>           printk(KERN_WARNING "Error while testing BO move.\n");
>> -    }
>>   }
>>     void amdgpu_test_moves(struct amdgpu_device *adev)
>> diff --git a/drivers/gpu/drm/amd/amdgpu/amdgpu_ttm.c
>> b/drivers/gpu/drm/amd/amdgpu/amdgpu_ttm.c
>> index 3b9053a..2a46bec 100644
>> --- a/drivers/gpu/drm/amd/amdgpu/amdgpu_ttm.c
>> +++ b/drivers/gpu/drm/amd/amdgpu/amdgpu_ttm.c
>> @@ -317,23 +317,19 @@ static int amdgpu_move_vram_ram(struct
>> ttm_buffer_object *bo,
>>       placements.flags = TTM_PL_MASK_CACHING | TTM_PL_FLAG_TT;
>>       r = ttm_bo_mem_space(bo, &placement, &tmp_mem,
>>                    interruptible, no_wait_gpu);
>> -    if (unlikely(r)) {
>> +    if (unlikely(r))
>>           return r;
>> -    }
>>         r = ttm_tt_set_placement_caching(bo->ttm, tmp_mem.placement);
>> -    if (unlikely(r)) {
>> +    if (unlikely(r))
>>           goto out_cleanup;
>> -    }
>>         r = ttm_tt_bind(bo->ttm, &tmp_mem);
>> -    if (unlikely(r)) {
>> +    if (unlikely(r))
>>           goto out_cleanup;
>> -    }
>>       r = amdgpu_move_blit(bo, true, no_wait_gpu, &tmp_mem, old_mem);
>> -    if (unlikely(r)) {
>> +    if (unlikely(r))
>>           goto out_cleanup;
>> -    }
>>       r = ttm_bo_move_ttm(bo, true, no_wait_gpu, new_mem);
>>   out_cleanup:
>>       ttm_bo_mem_put(bo, &tmp_mem);
>> @@ -364,17 +360,14 @@ static int amdgpu_move_ram_vram(struct
>> ttm_buffer_object *bo,
>>       placements.flags = TTM_PL_MASK_CACHING | TTM_PL_FLAG_TT;
>>       r = ttm_bo_mem_space(bo, &placement, &tmp_mem,
>>                    interruptible, no_wait_gpu);
>> -    if (unlikely(r)) {
>> +    if (unlikely(r))
>>           return r;
>> -    }
>>       r = ttm_bo_move_ttm(bo, true, no_wait_gpu, &tmp_mem);
>> -    if (unlikely(r)) {
>> +    if (unlikely(r))
>>           goto out_cleanup;
>> -    }
>>       r = amdgpu_move_blit(bo, true, no_wait_gpu, new_mem, old_mem);
>> -    if (unlikely(r)) {
>> +    if (unlikely(r))
>>           goto out_cleanup;
>> -    }
>>   out_cleanup:
>>       ttm_bo_mem_put(bo, &tmp_mem);
>>       return r;
>> @@ -430,9 +423,8 @@ static int amdgpu_bo_move(struct ttm_buffer_object
>> *bo,
>>       if (r) {
>>   memcpy:
>>           r = ttm_bo_move_memcpy(bo, evict, no_wait_gpu, new_mem);
>> -        if (r) {
>> +        if (r)
>>               return r;
>> -        }
>>       }
>>         /* update statistics */
>> @@ -704,9 +696,8 @@ static struct ttm_tt *amdgpu_ttm_tt_create(struct
>> ttm_bo_device *bdev,
>>       adev = amdgpu_get_adev(bdev);
>>         gtt = kzalloc(sizeof(struct amdgpu_ttm_tt), GFP_KERNEL);
>> -    if (gtt == NULL) {
>> +    if (gtt == NULL)
>>           return NULL;
>> -    }
>>       gtt->ttm.ttm.func = &amdgpu_backend_func;
>>       gtt->adev = adev;
>>       if (ttm_dma_tt_init(&gtt->ttm, bdev, size, page_flags,
>> dummy_read_page)) {
>> @@ -747,15 +738,13 @@ static int amdgpu_ttm_tt_populate(struct ttm_tt
>> *ttm)
>>       adev = amdgpu_get_adev(ttm->bdev);
>>     #ifdef CONFIG_SWIOTLB
>> -    if (swiotlb_nr_tbl()) {
>> +    if (swiotlb_nr_tbl())
>>           return ttm_dma_populate(&gtt->ttm, adev->dev);
>> -    }
>>   #endif
>>         r = ttm_pool_populate(ttm);
>> -    if (r) {
>> +    if (r)
>>           return r;
>> -    }
>>         for (i = 0; i < ttm->num_pages; i++) {
>>           gtt->ttm.dma_address[i] = pci_map_page(adev->pdev,
>> ttm->pages[i],
>> @@ -981,9 +970,8 @@ int amdgpu_ttm_init(struct amdgpu_device *adev)
>>       int r;
>>         r = amdgpu_ttm_global_init(adev);
>> -    if (r) {
>> +    if (r)
>>           return r;
>> -    }
>>       /* No others user of address space so set it to 0 */
>>       r = ttm_bo_device_init(&adev->mman.bdev,
>>                      adev->mman.bo_global_ref.ref.object,
>> @@ -1018,9 +1006,8 @@ int amdgpu_ttm_init(struct amdgpu_device *adev)
>>                    AMDGPU_GEM_DOMAIN_VRAM,
>>                    AMDGPU_GEM_CREATE_CPU_ACCESS_REQUIRED,
>>                    NULL, NULL, &adev->stollen_vga_memory);
>> -    if (r) {
>> +    if (r)
>>           return r;
>> -    }
>>       r = amdgpu_bo_reserve(adev->stollen_vga_memory, false);
>>       if (r)
>>           return r;
>> diff --git a/drivers/gpu/drm/amd/amdgpu/amdgpu_vce.c
>> b/drivers/gpu/drm/amd/amdgpu/amdgpu_vce.c
>> index 875626a..4abda0a 100644
>> --- a/drivers/gpu/drm/amd/amdgpu/amdgpu_vce.c
>> +++ b/drivers/gpu/drm/amd/amdgpu/amdgpu_vce.c
>> @@ -859,11 +859,10 @@ int amdgpu_vce_ring_test_ib(struct amdgpu_ring
>> *ring)
>>       }
>>         r = fence_wait(fence, false);
>> -    if (r) {
>> +    if (r)
>>           DRM_ERROR("amdgpu: fence wait failed (%d).\n", r);
>> -    } else {
>> +    else
>>           DRM_INFO("ib test on ring %d succeeded\n", ring->idx);
>> -    }
>>   error:
>>       fence_put(fence);
>>       return r;
>> diff --git a/drivers/gpu/drm/amd/amdgpu/amdgpu_vm.c
>> b/drivers/gpu/drm/amd/amdgpu/amdgpu_vm.c
>> index 9f36ed3..e480238 100644
>> --- a/drivers/gpu/drm/amd/amdgpu/amdgpu_vm.c
>> +++ b/drivers/gpu/drm/amd/amdgpu/amdgpu_vm.c
>> @@ -1122,9 +1122,8 @@ struct amdgpu_bo_va *amdgpu_vm_bo_add(struct
>> amdgpu_device *adev,
>>       struct amdgpu_bo_va *bo_va;
>>         bo_va = kzalloc(sizeof(struct amdgpu_bo_va), GFP_KERNEL);
>> -    if (bo_va == NULL) {
>> +    if (bo_va == NULL)
>>           return NULL;
>> -    }
>>       bo_va->vm = vm;
>>       bo_va->bo = bo;
>>       bo_va->ref_count = 1;
>> diff --git a/drivers/gpu/drm/amd/amdgpu/ci_dpm.c
>> b/drivers/gpu/drm/amd/amdgpu/ci_dpm.c
>> index b3b17bb..50a2d06 100644
>> --- a/drivers/gpu/drm/amd/amdgpu/ci_dpm.c
>> +++ b/drivers/gpu/drm/amd/amdgpu/ci_dpm.c
>> @@ -5726,9 +5726,8 @@ static void ci_dpm_fini(struct amdgpu_device *adev)
>>   {
>>       int i;
>>   -    for (i = 0; i < adev->pm.dpm.num_ps; i++) {
>> +    for (i = 0; i < adev->pm.dpm.num_ps; i++)
>>           kfree(adev->pm.dpm.ps[i].ps_priv);
>> -    }
>>       kfree(adev->pm.dpm.ps);
>>       kfree(adev->pm.dpm.priv);
>>       kfree(adev->pm.dpm.dyn_state.vddc_dependency_on_dispclk.entries);
>> diff --git a/drivers/gpu/drm/amd/amdgpu/cik_sdma.c
>> b/drivers/gpu/drm/amd/amdgpu/cik_sdma.c
>> index 554f2fd..4ec5b97 100644
>> --- a/drivers/gpu/drm/amd/amdgpu/cik_sdma.c
>> +++ b/drivers/gpu/drm/amd/amdgpu/cik_sdma.c
>> @@ -880,11 +880,10 @@ static void cik_sdma_ring_emit_vm_flush(struct
>> amdgpu_ring *ring,
>>                 SDMA_POLL_REG_MEM_EXTRA_FUNC(0)); /* always */
>>         amdgpu_ring_write(ring, SDMA_PACKET(SDMA_OPCODE_SRBM_WRITE, 0,
>> 0xf000));
>> -    if (vm_id < 8) {
>> +    if (vm_id < 8)
>>           amdgpu_ring_write(ring, (mmVM_CONTEXT0_PAGE_TABLE_BASE_ADDR
>> + vm_id));
>> -    } else {
>> +    else
>>           amdgpu_ring_write(ring, (mmVM_CONTEXT8_PAGE_TABLE_BASE_ADDR
>> + vm_id - 8));
>> -    }
>>       amdgpu_ring_write(ring, pd_addr >> 12);
>>         /* flush TLB */
>> diff --git a/drivers/gpu/drm/amd/amdgpu/fiji_smc.c
>> b/drivers/gpu/drm/amd/amdgpu/fiji_smc.c
>> index b336c91..13d7609 100644
>> --- a/drivers/gpu/drm/amd/amdgpu/fiji_smc.c
>> +++ b/drivers/gpu/drm/amd/amdgpu/fiji_smc.c
>> @@ -172,9 +172,7 @@ static int fiji_send_msg_to_smc_offset(struct
>> amdgpu_device *adev)
>>   static int fiji_send_msg_to_smc(struct amdgpu_device *adev,
>> PPSMC_Msg msg)
>>   {
>>       if (!fiji_is_smc_ram_running(adev))
>> -    {
>>           return -EINVAL;;
>> -    }
>>         if (wait_smu_response(adev)) {
>>           DRM_ERROR("Failed to send previous message\n");
>> diff --git a/drivers/gpu/drm/amd/amdgpu/gmc_v7_0.c
>> b/drivers/gpu/drm/amd/amdgpu/gmc_v7_0.c
>> index 1feb643..3df0e91 100644
>> --- a/drivers/gpu/drm/amd/amdgpu/gmc_v7_0.c
>> +++ b/drivers/gpu/drm/amd/amdgpu/gmc_v7_0.c
>> @@ -311,9 +311,8 @@ static void gmc_v7_0_mc_program(struct
>> amdgpu_device *adev)
>>           amdgpu_display_set_vga_render_state(adev, false);
>>         gmc_v7_0_mc_stop(adev, &save);
>> -    if (amdgpu_asic_wait_for_mc_idle(adev)) {
>> +    if (amdgpu_asic_wait_for_mc_idle(adev))
>>           dev_warn(adev->dev, "Wait for MC idle timedout !\n");
>> -    }
>>       /* Update configuration */
>>       WREG32(mmMC_VM_SYSTEM_APERTURE_LOW_ADDR,
>>              adev->mc.vram_start >> 12);
>> @@ -331,9 +330,8 @@ static void gmc_v7_0_mc_program(struct
>> amdgpu_device *adev)
>>       WREG32(mmMC_VM_AGP_BASE, 0);
>>       WREG32(mmMC_VM_AGP_TOP, 0x0FFFFFFF);
>>       WREG32(mmMC_VM_AGP_BOT, 0x0FFFFFFF);
>> -    if (amdgpu_asic_wait_for_mc_idle(adev)) {
>> +    if (amdgpu_asic_wait_for_mc_idle(adev))
>>           dev_warn(adev->dev, "Wait for MC idle timedout !\n");
>> -    }
>>       gmc_v7_0_mc_resume(adev, &save);
>>         WREG32(mmBIF_FB_EN, BIF_FB_EN__FB_READ_EN_MASK |
>> BIF_FB_EN__FB_WRITE_EN_MASK);
>> @@ -362,11 +360,10 @@ static int gmc_v7_0_mc_init(struct amdgpu_device
>> *adev)
>>         /* Get VRAM informations */
>>       tmp = RREG32(mmMC_ARB_RAMCFG);
>> -    if (REG_GET_FIELD(tmp, MC_ARB_RAMCFG, CHANSIZE)) {
>> +    if (REG_GET_FIELD(tmp, MC_ARB_RAMCFG, CHANSIZE))
>>           chansize = 64;
>> -    } else {
>> +    else
>>           chansize = 32;
>> -    }
>>       tmp = RREG32(mmMC_SHARED_CHMAP);
>>       switch (REG_GET_FIELD(tmp, MC_SHARED_CHMAP, NOOFCHAN)) {
>>       case 0:
>> diff --git a/drivers/gpu/drm/amd/amdgpu/gmc_v8_0.c
>> b/drivers/gpu/drm/amd/amdgpu/gmc_v8_0.c
>> index 9945d5b..4e093b8 100644
>> --- a/drivers/gpu/drm/amd/amdgpu/gmc_v8_0.c
>> +++ b/drivers/gpu/drm/amd/amdgpu/gmc_v8_0.c
>> @@ -393,9 +393,8 @@ static void gmc_v8_0_mc_program(struct
>> amdgpu_device *adev)
>>           amdgpu_display_set_vga_render_state(adev, false);
>>         gmc_v8_0_mc_stop(adev, &save);
>> -    if (amdgpu_asic_wait_for_mc_idle(adev)) {
>> +    if (amdgpu_asic_wait_for_mc_idle(adev))
>>           dev_warn(adev->dev, "Wait for MC idle timedout !\n");
>> -    }
>>       /* Update configuration */
>>       WREG32(mmMC_VM_SYSTEM_APERTURE_LOW_ADDR,
>>              adev->mc.vram_start >> 12);
>> @@ -413,9 +412,8 @@ static void gmc_v8_0_mc_program(struct
>> amdgpu_device *adev)
>>       WREG32(mmMC_VM_AGP_BASE, 0);
>>       WREG32(mmMC_VM_AGP_TOP, 0x0FFFFFFF);
>>       WREG32(mmMC_VM_AGP_BOT, 0x0FFFFFFF);
>> -    if (amdgpu_asic_wait_for_mc_idle(adev)) {
>> +    if (amdgpu_asic_wait_for_mc_idle(adev))
>>           dev_warn(adev->dev, "Wait for MC idle timedout !\n");
>> -    }
>>       gmc_v8_0_mc_resume(adev, &save);
>>         WREG32(mmBIF_FB_EN, BIF_FB_EN__FB_READ_EN_MASK |
>> BIF_FB_EN__FB_WRITE_EN_MASK);
>> @@ -444,11 +442,10 @@ static int gmc_v8_0_mc_init(struct amdgpu_device
>> *adev)
>>         /* Get VRAM informations */
>>       tmp = RREG32(mmMC_ARB_RAMCFG);
>> -    if (REG_GET_FIELD(tmp, MC_ARB_RAMCFG, CHANSIZE)) {
>> +    if (REG_GET_FIELD(tmp, MC_ARB_RAMCFG, CHANSIZE))
>>           chansize = 64;
>> -    } else {
>> +    else
>>           chansize = 32;
>> -    }
>>       tmp = RREG32(mmMC_SHARED_CHMAP);
>>       switch (REG_GET_FIELD(tmp, MC_SHARED_CHMAP, NOOFCHAN)) {
>>       case 0:
>> diff --git a/drivers/gpu/drm/amd/amdgpu/kv_dpm.c
>> b/drivers/gpu/drm/amd/amdgpu/kv_dpm.c
>> index a789a86..0585cd1 100644
>> --- a/drivers/gpu/drm/amd/amdgpu/kv_dpm.c
>> +++ b/drivers/gpu/drm/amd/amdgpu/kv_dpm.c
>> @@ -1499,11 +1499,10 @@ static int kv_update_uvd_dpm(struct
>> amdgpu_device *adev, bool gate)
>>           else
>>               pi->uvd_boot_level = 0;
>>   -        if (!pi->caps_uvd_dpm || pi->caps_stable_p_state) {
>> +        if (!pi->caps_uvd_dpm || pi->caps_stable_p_state)
>>               mask = 1 << pi->uvd_boot_level;
>> -        } else {
>> +        else
>>               mask = 0x1f;
>> -        }
>>             ret = amdgpu_kv_copy_bytes_to_smc(adev,
>>                          pi->dpm_table_start +
>> @@ -2607,9 +2606,8 @@ static int kv_parse_sys_info_table(struct
>> amdgpu_device *adev)
>>               pi->sys_info.htc_hyst_lmt = 5;
>>           else
>>               pi->sys_info.htc_hyst_lmt = igp_info->info_8.ucHtcHystLmt;
>> -        if (pi->sys_info.htc_tmp_lmt <= pi->sys_info.htc_hyst_lmt) {
>> +        if (pi->sys_info.htc_tmp_lmt <= pi->sys_info.htc_hyst_lmt)
>>               DRM_ERROR("The htcTmpLmt should be larger than
>> htcHystLmt.\n");
>> -        }
>>             if (le32_to_cpu(igp_info->info_8.ulSystemConfig) & (1 << 3))
>>               pi->sys_info.nb_dpm_enable = true;
>> @@ -2926,9 +2924,8 @@ static void kv_dpm_fini(struct amdgpu_device *adev)
>>   {
>>       int i;
>>   -    for (i = 0; i < adev->pm.dpm.num_ps; i++) {
>> +    for (i = 0; i < adev->pm.dpm.num_ps; i++)
>>           kfree(adev->pm.dpm.ps[i].ps_priv);
>> -    }
>>       kfree(adev->pm.dpm.ps);
>>       kfree(adev->pm.dpm.priv);
>>       amdgpu_free_extended_power_table(adev);
>> diff --git a/drivers/gpu/drm/amd/amdgpu/sdma_v2_4.c
>> b/drivers/gpu/drm/amd/amdgpu/sdma_v2_4.c
>> index 959cada9..98a841d 100644
>> --- a/drivers/gpu/drm/amd/amdgpu/sdma_v2_4.c
>> +++ b/drivers/gpu/drm/amd/amdgpu/sdma_v2_4.c
>> @@ -935,11 +935,10 @@ static void sdma_v2_4_ring_emit_vm_flush(struct
>> amdgpu_ring *ring,
>>   {
>>       amdgpu_ring_write(ring, SDMA_PKT_HEADER_OP(SDMA_OP_SRBM_WRITE) |
>>                 SDMA_PKT_SRBM_WRITE_HEADER_BYTE_EN(0xf));
>> -    if (vm_id < 8) {
>> +    if (vm_id < 8)
>>           amdgpu_ring_write(ring, (mmVM_CONTEXT0_PAGE_TABLE_BASE_ADDR
>> + vm_id));
>> -    } else {
>> +    else
>>           amdgpu_ring_write(ring, (mmVM_CONTEXT8_PAGE_TABLE_BASE_ADDR
>> + vm_id - 8));
>> -    }
>>       amdgpu_ring_write(ring, pd_addr >> 12);
>>         /* flush TLB */
>> diff --git a/drivers/gpu/drm/amd/amdgpu/sdma_v3_0.c
>> b/drivers/gpu/drm/amd/amdgpu/sdma_v3_0.c
>> index f96fdc8..7710129 100644
>> --- a/drivers/gpu/drm/amd/amdgpu/sdma_v3_0.c
>> +++ b/drivers/gpu/drm/amd/amdgpu/sdma_v3_0.c
>> @@ -1163,11 +1163,10 @@ static void
>> sdma_v3_0_ring_emit_vm_flush(struct amdgpu_ring *ring,
>>   {
>>       amdgpu_ring_write(ring, SDMA_PKT_HEADER_OP(SDMA_OP_SRBM_WRITE) |
>>                 SDMA_PKT_SRBM_WRITE_HEADER_BYTE_EN(0xf));
>> -    if (vm_id < 8) {
>> +    if (vm_id < 8)
>>           amdgpu_ring_write(ring, (mmVM_CONTEXT0_PAGE_TABLE_BASE_ADDR
>> + vm_id));
>> -    } else {
>> +    else
>>           amdgpu_ring_write(ring, (mmVM_CONTEXT8_PAGE_TABLE_BASE_ADDR
>> + vm_id - 8));
>> -    }
>>       amdgpu_ring_write(ring, pd_addr >> 12);
>>         /* flush TLB */
>> diff --git a/drivers/gpu/drm/amd/amdgpu/tonga_smc.c
>> b/drivers/gpu/drm/amd/amdgpu/tonga_smc.c
>> index 083893d..2d281ce 100644
>> --- a/drivers/gpu/drm/amd/amdgpu/tonga_smc.c
>> +++ b/drivers/gpu/drm/amd/amdgpu/tonga_smc.c
>> @@ -172,9 +172,7 @@ static int tonga_send_msg_to_smc_offset(struct
>> amdgpu_device *adev)
>>   static int tonga_send_msg_to_smc(struct amdgpu_device *adev,
>> PPSMC_Msg msg)
>>   {
>>       if (!tonga_is_smc_ram_running(adev))
>> -    {
>>           return -EINVAL;;
>> -    }
>>         if (wait_smu_response(adev)) {
>>           DRM_ERROR("Failed to send previous message\n");
> 
> 

-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 819 bytes
Desc: OpenPGP digital signature
URL: <https://lists.freedesktop.org/archives/amd-gfx/attachments/20160711/7c1a34f0/attachment-0001.sig>


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

  Powered by Linux