[Lima] [PATCH] drm/lima: fix ifnullfree.cocci warnings

kbuild test robot lkp at intel.com
Mon Feb 25 18:39:27 UTC 2019


From: kbuild test robot <lkp at intel.com>

drivers/gpu/drm/lima/lima_object.c:14:3-8: WARNING: NULL check before some freeing functions is not needed.
drivers/gpu/drm/lima/lima_object.c:35:2-7: WARNING: NULL check before some freeing functions is not needed.

 NULL check before some freeing functions is not needed.

 Based on checkpatch warning
 "kfree(NULL) is safe this check is probably not required"
 and kfreeaddr.cocci by Julia Lawall.

Generated by: scripts/coccinelle/free/ifnullfree.cocci

Fixes: ef1d65006858 ("drm/lima: driver for ARM Mali4xx GPUs")
CC: Qiang Yu <yuq825 at gmail.com>
Signed-off-by: kbuild test robot <fengguang.wu at intel.com>
---

url:    https://github.com/0day-ci/linux/commits/Qiang-Yu/drm-export-drm_timeout_abs_to_jiffies/20190226-010350

Please take the patch only if it's a positive warning. Thanks!

 lima_object.c |    6 ++----
 1 file changed, 2 insertions(+), 4 deletions(-)

--- a/drivers/gpu/drm/lima/lima_object.c
+++ b/drivers/gpu/drm/lima/lima_object.c
@@ -10,8 +10,7 @@
 void lima_bo_destroy(struct lima_bo *bo)
 {
         if (bo->sgt) {
-		if (bo->pages)
-			kfree(bo->pages);
+		kfree(bo->pages);
 
 		drm_prime_gem_destroy(&bo->gem, bo->sgt);
 	}
@@ -31,8 +30,7 @@ void lima_bo_destroy(struct lima_bo *bo)
 			drm_gem_put_pages(&bo->gem, bo->pages, true, true);
 	}
 
-	if (bo->pages_dma_addr)
-		kfree(bo->pages_dma_addr);
+	kfree(bo->pages_dma_addr);
 
 	drm_gem_object_release(&bo->gem);
 	kfree(bo);


More information about the lima mailing list