Skip to contentSkip to conversation

drm/amdgpu/acpi: NULL check before some freeing functions is not needed

PATCH Applied Wen Yang 3 participants 3 messages Dec 5, 2018 2 messages not in the archive

Subsystems (2)
lore
Share & tools
lore

Wen Yang

author
#0 lore raw

PATCH 1/1 drm/amdgpu/acpi: NULL check before some freeing functions is not needed

kfree(NULL) is safe, so removes NULL check before freeing the mem. This patch also fix the ifnullfree.cocci warnings.

CC Alex Deucher <[email protected]>
CC "David (ChunMing) Zhou" <[email protected]>
CC David Airlie <[email protected]> (maintainer:DRM DRIVERS)
CC Lyude Paul <[email protected]>
CC Rex Zhu <[email protected]>
CC Jim Qu <[email protected]>
---
 drivers/gpu/drm/amd/amdgpu/amdgpu_acpi.c | 3 +--
 1 file changed, 1 insertion(+), 2 deletions(-)
drivers/gpu/drm/amd/amdgpu/amdgpu_acpi.c +1 -2
index 7f0afc526419..996bfce149f2 100644
@@ -816,6 +816,5 @@ int amdgpu_acpi_init(struct amdgpu_device *adev)
 void amdgpu_acpi_fini(struct amdgpu_device *adev)
 {
 	unregister_acpi_notifier(&adev->acpi_nb);
-	if (adev->atif)
-		kfree(adev->atif);
+	kfree(adev->atif);
 }
Signature · 6 lines
2.19.1

_______________________________________________
amd-gfx mailing list
[email protected]
https://lists.freedesktop.org/mailman/listinfo/amd-gfx

A message that is not in the archive (sent off-list or not yet received): 20181205074319.25030-1-wen.yang99-Th6q7B73Y6EnDS1+zs4M5A@public.gmane.org

Reviewed-by
#2 lore raw

Thanks!

Quoted 30 lines · Wen Yang

kfree(NULL) is safe, so removes NULL check before freeing the mem. This patch also fix the ifnullfree.cocci warnings.

CC Alex Deucher <[email protected]>
CC "David (ChunMing) Zhou" <[email protected]>
CC David Airlie <[email protected]> (maintainer:DRM DRIVERS)
CC Lyude Paul <[email protected]>
CC Rex Zhu <[email protected]>
CC Jim Qu <[email protected]>
---
 drivers/gpu/drm/amd/amdgpu/amdgpu_acpi.c | 3 +--
 1 file changed, 1 insertion(+), 2 deletions(-)
drivers/gpu/drm/amd/amdgpu/amdgpu_acpi.c +1 -2
index 7f0afc526419..996bfce149f2 100644
@@ -816,6 +816,5 @@ int amdgpu_acpi_init(struct amdgpu_device *adev)
 void amdgpu_acpi_fini(struct amdgpu_device *adev)
 {
 	unregister_acpi_notifier(&adev->acpi_nb);
-	if (adev->atif)
-		kfree(adev->atif);
+	kfree(adev->atif);
 }
Signature · 7 lines
Cheers,
	Lyude Paul

_______________________________________________
amd-gfx mailing list
[email protected]
https://lists.freedesktop.org/mailman/listinfo/amd-gfx

A message that is not in the archive (sent off-list or not yet received): a19680277a06b409d311b476b6fd552194ebe6ab.camel-H+wXaHxf7aLQT0dZR+AlfA@public.gmane.org

Applied
#4 lore raw

Applied. thanks!

Alex

Quoted 40 lines · Lyude Paul

Thanks!

Quoted 23 lines · Wen Yang

kfree(NULL) is safe, so removes NULL check before freeing the mem. This patch also fix the ifnullfree.cocci warnings.

CC Alex Deucher <[email protected]>
CC "David (ChunMing) Zhou" <[email protected]>
CC David Airlie <[email protected]> (maintainer:DRM DRIVERS)
CC Lyude Paul <[email protected]>
CC Rex Zhu <[email protected]>
CC Jim Qu <[email protected]>
---
 drivers/gpu/drm/amd/amdgpu/amdgpu_acpi.c | 3 +--
 1 file changed, 1 insertion(+), 2 deletions(-)
drivers/gpu/drm/amd/amdgpu/amdgpu_acpi.c +0 -0
index 7f0afc526419..996bfce149f2 100644

drivers/gpu/drm/amd/amdgpu/amdgpu_acpi.c int amdgpu_acpi_init(struct amdgpu_device *adev) · line 820

Quoted 7 lines
drivers/gpu/drm/amd/amdgpu/amdgpu_acpi.c +1 -2
@@ -816,6 +816,5 @@ int amdgpu_acpi_init(struct amdgpu_device *adev)
 void amdgpu_acpi_fini(struct amdgpu_device *adev)
 {
      unregister_acpi_notifier(&adev->acpi_nb);
-     if (adev->atif)
-             kfree(adev->atif);
+     kfree(adev->atif);
 }

--
Cheers,
Lyude Paul

Quoted 4 lines

_______________________________________________
amd-gfx mailing list
[email protected]
https://lists.freedesktop.org/mailman/listinfo/amd-gfx

_______________________________________________
amd-gfx mailing list
[email protected]
https://lists.freedesktop.org/mailman/listinfo/amd-gfx