diff mbox series

drm/lima: fix ifnullfree.cocci warnings

Message ID 20190225183927.GA32253@lkp-wsm-ep1 (mailing list archive)
State New, archived
Headers show
Series drm/lima: fix ifnullfree.cocci warnings | expand

Commit Message

kernel test robot Feb. 25, 2019, 6:39 p.m. UTC
From: kbuild test robot <lkp@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@gmail.com>
Signed-off-by: kbuild test robot <fengguang.wu@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(-)
diff mbox series

Patch

--- 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);