FW: [PATCH 3/3] drm/amdgpu: remove unnecessary NULL check in amdgpu_device.c
Yu, Lang
Lang.Yu at amd.com
Thu Oct 21 07:20:01 UTC 2021
[AMD Official Use Only]
>-----Original Message-----
>From: Yu, Lang <Lang.Yu at amd.com>
>Sent: Thursday, October 21, 2021 3:18 PM
>To: Grodzovsky, Andrey <Andrey.Grodzovsky at amd.com>
>Cc: Deucher, Alexander <Alexander.Deucher at amd.com>; Koenig, Christian
><Christian.Koenig at amd.com>; Huang, Ray <Ray.Huang at amd.com>; Yu, Lang
><Lang.Yu at amd.com>
>Subject: [PATCH 3/3] drm/amdgpu: remove unnecessary NULL check in
>amdgpu_device.c
>
>NULL is safe for these functions.
>
>Signed-off-by: Lang Yu <lang.yu at amd.com>
>---
> drivers/gpu/drm/amd/amdgpu/amdgpu_device.c | 17 +++++++----------
> 1 file changed, 7 insertions(+), 10 deletions(-)
>
>diff --git a/drivers/gpu/drm/amd/amdgpu/amdgpu_device.c
>b/drivers/gpu/drm/amd/amdgpu/amdgpu_device.c
>index be64861ed19a..dd979db93399 100644
>--- a/drivers/gpu/drm/amd/amdgpu/amdgpu_device.c
>+++ b/drivers/gpu/drm/amd/amdgpu/amdgpu_device.c
>@@ -1091,12 +1091,9 @@ static void amdgpu_device_doorbell_fini(struct
>amdgpu_device *adev)
> */
> static void amdgpu_device_wb_fini(struct amdgpu_device *adev) {
>- if (adev->wb.wb_obj) {
>- amdgpu_bo_free_kernel(&adev->wb.wb_obj,
>- &adev->wb.gpu_addr,
>- (void **)&adev->wb.wb);
>- adev->wb.wb_obj = NULL;
>- }
>+ amdgpu_bo_free_kernel(&adev->wb.wb_obj,
>+ &adev->wb.gpu_addr,
>+ (void **)&adev->wb.wb);
> }
>
> /**
>@@ -3794,8 +3791,8 @@ static void amdgpu_device_unmap_mmio(struct
>amdgpu_device *adev)
>
> iounmap(adev->rmmio);
> adev->rmmio = NULL;
>- if (adev->mman.aper_base_kaddr)
>- iounmap(adev->mman.aper_base_kaddr);
>+
>+ iounmap(adev->mman.aper_base_kaddr);
> adev->mman.aper_base_kaddr = NULL;
>
> /* Memory manager related */
>@@ -3886,8 +3883,8 @@ void amdgpu_device_fini_sw(struct amdgpu_device
>*adev)
>
> if (IS_ENABLED(CONFIG_PERF_EVENTS))
> amdgpu_pmu_fini(adev);
>- if (adev->mman.discovery_bin)
>- amdgpu_discovery_fini(adev);
>+
>+ amdgpu_discovery_fini(adev);
>
> amdgpu_device_free_pci_state(adev);
> }
>--
>2.25.1
More information about the amd-gfx
mailing list