Blame SOURCES/0085-scsi-scsi-qla2xxx-NULL-check-before-some-freeing-fun.patch

3c6e85
From c3beeeba12adf40609862b3ec075fb9289d59bd1 Mon Sep 17 00:00:00 2001
3c6e85
From: Himanshu Madhani <hmadhani@redhat.com>
3c6e85
Date: Thu, 1 Aug 2019 15:55:45 -0400
3c6e85
Subject: [PATCH 085/124] [scsi] scsi: qla2xxx: NULL check before some freeing
3c6e85
 functions is not needed
3c6e85
3c6e85
Message-id: <20190801155618.12650-86-hmadhani@redhat.com>
3c6e85
Patchwork-id: 267864
3c6e85
O-Subject: [RHEL 7.8 e-stor PATCH 085/118] scsi: qla2xxx: NULL check before some freeing functions is not needed
3c6e85
Bugzilla: 1729270
3c6e85
RH-Acked-by: Jarod Wilson <jarod@redhat.com>
3c6e85
RH-Acked-by: Tony Camuso <tcamuso@redhat.com>
3c6e85
3c6e85
From: Thomas Meyer <thomas@m3y3r.de>
3c6e85
3c6e85
Bugzilla 1729270
3c6e85
3c6e85
NULL check before some freeing functions is not needed.
3c6e85
3c6e85
Signed-off-by: Thomas Meyer <thomas@m3y3r.de>
3c6e85
Acked-by: Himanshu Madhani <hmadhani@marvell.com>
3c6e85
Signed-off-by: Martin K. Petersen <martin.petersen@oracle.com>
3c6e85
(cherry picked from commit 75c1d48a338bdf3ce850166be527598017e0ebca)
3c6e85
Signed-off-by: Himanshu Madhani <hmadhani@redhat.com>
3c6e85
Signed-off-by: Jan Stancek <jstancek@redhat.com>
3c6e85
---
3c6e85
 drivers/scsi/qla2xxx/qla_os.c | 24 ++++++++----------------
3c6e85
 1 file changed, 8 insertions(+), 16 deletions(-)
3c6e85
3c6e85
diff --git a/drivers/scsi/qla2xxx/qla_os.c b/drivers/scsi/qla2xxx/qla_os.c
3c6e85
index d85dd97a883a..326c0e6588de 100644
3c6e85
--- a/drivers/scsi/qla2xxx/qla_os.c
3c6e85
+++ b/drivers/scsi/qla2xxx/qla_os.c
3c6e85
@@ -4493,12 +4493,10 @@ fail_free_nvram:
3c6e85
 	kfree(ha->nvram);
3c6e85
 	ha->nvram = NULL;
3c6e85
 fail_free_ctx_mempool:
3c6e85
-	if (ha->ctx_mempool)
3c6e85
-		mempool_destroy(ha->ctx_mempool);
3c6e85
+	mempool_destroy(ha->ctx_mempool);
3c6e85
 	ha->ctx_mempool = NULL;
3c6e85
 fail_free_srb_mempool:
3c6e85
-	if (ha->srb_mempool)
3c6e85
-		mempool_destroy(ha->srb_mempool);
3c6e85
+	mempool_destroy(ha->srb_mempool);
3c6e85
 	ha->srb_mempool = NULL;
3c6e85
 fail_free_gid_list:
3c6e85
 	dma_free_coherent(&ha->pdev->dev, qla2x00_gid_list_size(ha),
3c6e85
@@ -4806,8 +4804,7 @@ qla2x00_mem_free(struct qla_hw_data *ha)
3c6e85
 		dma_free_coherent(&ha->pdev->dev, MCTP_DUMP_SIZE, ha->mctp_dump,
3c6e85
 		    ha->mctp_dump_dma);
3c6e85
 
3c6e85
-	if (ha->srb_mempool)
3c6e85
-		mempool_destroy(ha->srb_mempool);
3c6e85
+	mempool_destroy(ha->srb_mempool);
3c6e85
 
3c6e85
 	if (ha->dcbx_tlv)
3c6e85
 		dma_free_coherent(&ha->pdev->dev, DCBX_TLV_DATA_SIZE,
3c6e85
@@ -4843,8 +4840,7 @@ qla2x00_mem_free(struct qla_hw_data *ha)
3c6e85
 	if (ha->async_pd)
3c6e85
 		dma_pool_free(ha->s_dma_pool, ha->async_pd, ha->async_pd_dma);
3c6e85
 
3c6e85
-	if (ha->s_dma_pool)
3c6e85
-		dma_pool_destroy(ha->s_dma_pool);
3c6e85
+	dma_pool_destroy(ha->s_dma_pool);
3c6e85
 
3c6e85
 	if (ha->gid_list)
3c6e85
 		dma_free_coherent(&ha->pdev->dev, qla2x00_gid_list_size(ha),
3c6e85
@@ -4865,14 +4861,11 @@ qla2x00_mem_free(struct qla_hw_data *ha)
3c6e85
 		}
3c6e85
 	}
3c6e85
 
3c6e85
-	if (ha->dl_dma_pool)
3c6e85
-		dma_pool_destroy(ha->dl_dma_pool);
3c6e85
+	dma_pool_destroy(ha->dl_dma_pool);
3c6e85
 
3c6e85
-	if (ha->fcp_cmnd_dma_pool)
3c6e85
-		dma_pool_destroy(ha->fcp_cmnd_dma_pool);
3c6e85
+	dma_pool_destroy(ha->fcp_cmnd_dma_pool);
3c6e85
 
3c6e85
-	if (ha->ctx_mempool)
3c6e85
-		mempool_destroy(ha->ctx_mempool);
3c6e85
+	mempool_destroy(ha->ctx_mempool);
3c6e85
 
3c6e85
 	if (ql2xenabledif) {
3c6e85
 		struct dsd_dma *dsd, *nxt;
3c6e85
@@ -7467,8 +7460,7 @@ qla2x00_module_exit(void)
3c6e85
 	qla2x00_release_firmware();
3c6e85
 	kmem_cache_destroy(srb_cachep);
3c6e85
 	qlt_exit();
3c6e85
-	if (ctx_cachep)
3c6e85
-		kmem_cache_destroy(ctx_cachep);
3c6e85
+	kmem_cache_destroy(ctx_cachep);
3c6e85
 	fc_release_transport(qla2xxx_transport_template);
3c6e85
 	fc_release_transport(qla2xxx_transport_vport_template);
3c6e85
 }
3c6e85
-- 
3c6e85
2.13.6
3c6e85