diff mbox

drivers: crypto: fix ifnullfree.cocci warnings

Message ID 20170112133857.GA56852@cairo.lkp.intel.com (mailing list archive)
State Not Applicable
Delegated to: Herbert Xu
Headers show

Commit Message

kernel test robot Jan. 12, 2017, 1:38 p.m. UTC
drivers/crypto/cavium/cpt/cptvf_reqmanager.c:312:2-8: 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.
drivers/crypto/cavium/cpt/cptvf_reqmanager.c:315:2-8: 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.
drivers/crypto/cavium/cpt/cptvf_reqmanager.c:318:2-8: 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.
drivers/crypto/cavium/cpt/cptvf_reqmanager.c:321:2-8: 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

CC: George Cherian <george.cherian@cavium.com>
Signed-off-by: Fengguang Wu <fengguang.wu@intel.com>
---

 cptvf_reqmanager.c |   12 ++++--------
 1 file changed, 4 insertions(+), 8 deletions(-)

--
To unsubscribe from this list: send the line "unsubscribe linux-crypto" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
diff mbox

Patch

--- a/drivers/crypto/cavium/cpt/cptvf_reqmanager.c
+++ b/drivers/crypto/cavium/cpt/cptvf_reqmanager.c
@@ -308,17 +308,13 @@  void do_request_cleanup(struct cpt_vf *c
 		}
 	}
 
-	if (info->scatter_components)
-		kzfree(info->scatter_components);
+	kzfree(info->scatter_components);
 
-	if (info->gather_components)
-		kzfree(info->gather_components);
+	kzfree(info->gather_components);
 
-	if (info->out_buffer)
-		kzfree(info->out_buffer);
+	kzfree(info->out_buffer);
 
-	if (info->in_buffer)
-		kzfree(info->in_buffer);
+	kzfree(info->in_buffer);
 
 	if (info->completion_addr)
 		kzfree((void *)info->completion_addr);