diff mbox series

drm/lima: fix ifnullfree.cocci warnings

Message ID 20190225183927.GA32733@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_sched.c:35:2-20: WARNING: NULL check before some freeing functions is not needed.
drivers/gpu/drm/lima/lima_sched.c:146: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_sched.c |    6 ++----
 1 file changed, 2 insertions(+), 4 deletions(-)
diff mbox series

Patch

--- a/drivers/gpu/drm/lima/lima_sched.c
+++ b/drivers/gpu/drm/lima/lima_sched.c
@@ -31,8 +31,7 @@  int lima_sched_slab_init(void)
 
 void lima_sched_slab_fini(void)
 {
-	if (lima_fence_slab)
-		kmem_cache_destroy(lima_fence_slab);
+	kmem_cache_destroy(lima_fence_slab);
 }
 
 static inline struct lima_fence *to_lima_fence(struct dma_fence *fence)
@@ -142,8 +141,7 @@  void lima_sched_task_fini(struct lima_sc
 			dma_fence_put(task->dep[i]);
 	}
 
-	if (task->dep)
-		kfree(task->dep);
+	kfree(task->dep);
 
 	if (task->bos) {
 		for (i = 0; i < task->num_bos; i++)