diff mbox

drm/i915: fix ifnullfree.cocci warnings

Message ID 20170615152312.GA3688@xian.lkp.intel.com (mailing list archive)
State New, archived
Headers show

Commit Message

Fengguang Wu June 15, 2017, 3:23 p.m. UTC
drivers/gpu/drm/i915/i915_gem_execbuffer.c:300:2-7: WARNING: NULL check before freeing functions like kfree, debugfs_remove, debugfs_remove_recursive or usb_free_urb is not needed. Maybe consider reorganizing relevant code to avoid passing NULL values.

 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

Signed-off-by: Fengguang Wu <fengguang.wu@intel.com>
---

 i915_gem_execbuffer.c |    3 +--
 1 file changed, 1 insertion(+), 2 deletions(-)

Comments

Chris Wilson June 15, 2017, 4:07 p.m. UTC | #1
Quoting kbuild test robot (2017-06-15 16:23:12)
> drivers/gpu/drm/i915/i915_gem_execbuffer.c:300:2-7: WARNING: NULL check before freeing functions like kfree, debugfs_remove, debugfs_remove_recursive or usb_free_urb is not needed. Maybe consider reorganizing relevant code to avoid passing NULL values.

It exists because it was a stepping towards the compare being not
against NULL.
-Chris
diff mbox

Patch

--- a/drivers/gpu/drm/i915/i915_gem_execbuffer.c
+++ b/drivers/gpu/drm/i915/i915_gem_execbuffer.c
@@ -296,8 +296,7 @@  static void eb_destroy(struct i915_execb
 
 	i915_gem_context_put(eb->ctx);
 
-	if (eb->buckets)
-		kfree(eb->buckets);
+	kfree(eb->buckets);
 }
 
 static inline int use_cpu_reloc(struct drm_i915_gem_object *obj)