diff mbox

uvcvideo: fix ifnullfree.cocci warnings

Message ID 20170730063151.GA22846@lkp-nex05 (mailing list archive)
State New, archived
Headers show

Commit Message

kernel test robot July 30, 2017, 6:31 a.m. UTC
drivers/media/usb/uvc/uvc_ctrl.c:1327: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

Fixes: c698cbbd35da ("uvcvideo: send a control event when a Control Change interrupt arrives")
CC: Guennadi Liakhovetski <g.liakhovetski@gmx.de>
Signed-off-by: Fengguang Wu <fengguang.wu@intel.com>
---

 uvc_ctrl.c |    3 +--
 1 file changed, 1 insertion(+), 2 deletions(-)
diff mbox

Patch

--- a/drivers/media/usb/uvc/uvc_ctrl.c
+++ b/drivers/media/usb/uvc/uvc_ctrl.c
@@ -1322,9 +1322,8 @@  void uvc_ctrl_status_event(struct uvc_de
 		return;
 
 	spin_lock(&w->lock);
-	if (w->data)
 		/* A previous event work hasn't run yet, we lose 1 event */
-		kfree(w->data);
+	kfree(w->data);
 
 	w->data = kmalloc(len, GFP_ATOMIC);
 	if (w->data) {