diff mbox series

libfc: remove unnecessary condition check

Message ID 20180827235008.14051-1-cgxu519@gmx.com (mailing list archive)
State Accepted
Headers show
Series libfc: remove unnecessary condition check | expand

Commit Message

Chengguang Xu Aug. 27, 2018, 11:50 p.m. UTC
kmem_cache_destroy() can handle NULL pointer correctly, so there is
no need to check NULL pointer before calling kmem_cache_destroy()

Signed-off-by: Chengguang Xu <cgxu519@gmx.com>
---
 drivers/scsi/libfc/fc_fcp.c | 3 +--
 1 file changed, 1 insertion(+), 2 deletions(-)

Comments

Johannes Thumshirn Aug. 28, 2018, 8:15 a.m. UTC | #1
Acked-by: Johannes Thumshirn <jth@kernel.org>
Martin K. Petersen Aug. 30, 2018, 11:37 a.m. UTC | #2
Chengguang,

> kmem_cache_destroy() can handle NULL pointer correctly, so there is
> no need to check NULL pointer before calling kmem_cache_destroy()

Applied to 4.20/scsi-queue, thank you.
diff mbox series

Patch

diff --git a/drivers/scsi/libfc/fc_fcp.c b/drivers/scsi/libfc/fc_fcp.c
index 4fae253d4f3d..563247def49a 100644
--- a/drivers/scsi/libfc/fc_fcp.c
+++ b/drivers/scsi/libfc/fc_fcp.c
@@ -2295,8 +2295,7 @@  int fc_setup_fcp(void)
 
 void fc_destroy_fcp(void)
 {
-	if (scsi_pkt_cachep)
-		kmem_cache_destroy(scsi_pkt_cachep);
+	kmem_cache_destroy(scsi_pkt_cachep);
 }
 
 /**