From: James Smart Date: Wed, 12 Jul 2017 22:33:40 +0000 (-0400) Subject: lpfc: Remove NULL ptr check before kfree. X-Git-Tag: v4.1.12-106.0.20170720_1900~60 X-Git-Url: https://www.infradead.org/git/?a=commitdiff_plain;h=0e1f6d30a28543cd4a2508c7c7c3dff7cdee6043;p=users%2Fjedix%2Flinux-maple.git lpfc: Remove NULL ptr check before kfree. [backport of 600b57091effbdb680c067332c92de2a21c5d79d] From: rkennedy Orabug: 26439257 The check for NULL ptr is not necessary, kfree will check it. Removing NULL ptr check. Signed-off-by: Dick Kennedy Signed-off-by: James Smart Reviewed-by: Johannes Thumshirn This patch was applied manually. Signed-off-by: Brian Maly --- diff --git a/drivers/scsi/lpfc/lpfc_debugfs.c b/drivers/scsi/lpfc/lpfc_debugfs.c index 6e7a024919a9..02fbbe2aad7b 100644 --- a/drivers/scsi/lpfc/lpfc_debugfs.c +++ b/drivers/scsi/lpfc/lpfc_debugfs.c @@ -4500,14 +4500,11 @@ lpfc_debugfs_terminate(struct lpfc_vport *vport) #ifdef CONFIG_SCSI_LPFC_DEBUG_FS struct lpfc_hba *phba = vport->phba; - if (vport->disc_trc) { - kfree(vport->disc_trc); - vport->disc_trc = NULL; - } - if (vport->debug_disc_trc) { - debugfs_remove(vport->debug_disc_trc); /* discovery_trace */ - vport->debug_disc_trc = NULL; - } + kfree(vport->disc_trc); + vport->disc_trc = NULL; + + debugfs_remove(vport->debug_disc_trc); /* discovery_trace */ + vport->debug_disc_trc = NULL; if (vport->debug_nodelist) { debugfs_remove(vport->debug_nodelist); /* nodelist */ vport->debug_nodelist = NULL; @@ -4577,15 +4574,12 @@ lpfc_debugfs_terminate(struct lpfc_vport *vport) phba->debug_readRef = NULL; } - if (phba->slow_ring_trc) { - kfree(phba->slow_ring_trc); - phba->slow_ring_trc = NULL; - } - if (phba->debug_slow_ring_trc) { - /* slow_ring_trace */ - debugfs_remove(phba->debug_slow_ring_trc); - phba->debug_slow_ring_trc = NULL; - } + kfree(phba->slow_ring_trc); + phba->slow_ring_trc = NULL; + + /* slow_ring_trace */ + debugfs_remove(phba->debug_slow_ring_trc); + phba->debug_slow_ring_trc = NULL; /* * iDiag release