diff mbox

qla2xxx: fix ifnullfree.cocci warnings

Message ID 20151208021042.GA70165@lkp-ib04 (mailing list archive)
State New, archived
Headers show

Commit Message

kernel test robot Dec. 8, 2015, 2:10 a.m. UTC
drivers/scsi/qla2xxx/qla_iocb.c:2022: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

CC: Himanshu Madhani <himanshu.madhani@qlogic.com>
Signed-off-by: Fengguang Wu <fengguang.wu@intel.com>

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

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


--- a/drivers/scsi/qla2xxx/qla_iocb.c
+++ b/drivers/scsi/qla2xxx/qla_iocb.c
@@ -2018,8 +2018,7 @@  qla2x00_els_dcmd_sp_free(void *ptr, void
 	srb_t *sp = (srb_t *)data;
 	struct srb_iocb *elsio = &sp->u.iocb_cmd;
-	if (sp->fcport)
-		kfree(sp->fcport);
+	kfree(sp->fcport);
 	if (elsio->u.els_logo.els_logo_pyld)
 		dma_free_coherent(&ha->pdev->dev, DMA_POOL_SIZE,