diff mbox

scsi: megaraid: fix ifnullfree.cocci warnings

Message ID 20170725154005.GA50666@lkp-hsx03.lkp.intel.com (mailing list archive)
State Not Applicable
Headers show

Commit Message

Fengguang Wu July 25, 2017, 3:40 p.m. UTC
drivers/scsi/megaraid/megaraid_mm.c:1020:2-18: 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: cbb80044a6c7 ("scsi: megaraid: Replace PCI pool old API")
CC: Romain Perier <romain.perier@collabora.com>
Signed-off-by: Fengguang Wu <fengguang.wu@intel.com>
---

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

Patch

--- a/drivers/scsi/megaraid/megaraid_mm.c
+++ b/drivers/scsi/megaraid/megaraid_mm.c
@@ -1016,8 +1016,7 @@  memalloc_error:
 	kfree(adapter->kioc_list);
 	kfree(adapter->mbox_list);
 
-	if (adapter->pthru_dma_pool)
-		dma_pool_destroy(adapter->pthru_dma_pool);
+	dma_pool_destroy(adapter->pthru_dma_pool);
 
 	kfree(adapter);