linux-scsi.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH] scsi: csiostor: NULL check before some freeing functions is not needed.
       [not found] <1543760930050-1499171309-0-diffsplit-thomas@m3y3r.de>
@ 2018-12-02 20:52 ` Thomas Meyer
  2018-12-02 20:52 ` [PATCH] scsi: ipr: " Thomas Meyer
                   ` (8 subsequent siblings)
  9 siblings, 0 replies; 17+ messages in thread
From: Thomas Meyer @ 2018-12-02 20:52 UTC (permalink / raw)
  To: jejb, martin.petersen, linux-scsi, linux-kernel

NULL check before some freeing functions is not needed.

Signed-off-by: Thomas Meyer <thomas@m3y3r.de>
---

diff -u -p a/drivers/scsi/csiostor/csio_init.c b/drivers/scsi/csiostor/csio_init.c
--- a/drivers/scsi/csiostor/csio_init.c
+++ b/drivers/scsi/csiostor/csio_init.c
@@ -157,8 +157,7 @@ csio_dfs_create(struct csio_hw *hw)
 static int
 csio_dfs_destroy(struct csio_hw *hw)
 {
-	if (hw->debugfs_root)
-		debugfs_remove_recursive(hw->debugfs_root);
+	debugfs_remove_recursive(hw->debugfs_root);
 
 	return 0;
 }

^ permalink raw reply	[flat|nested] 17+ messages in thread

* [PATCH] scsi: qla4xxx: NULL check before some freeing functions is not needed.
       [not found] <1543760930050-1499171309-0-diffsplit-thomas@m3y3r.de>
                   ` (6 preceding siblings ...)
  2018-12-02 20:52 ` [PATCH] scsi: lpfc: " Thomas Meyer
@ 2018-12-02 20:52 ` Thomas Meyer
  2018-12-03  5:48   ` Rangankar, Manish
  2018-12-02 20:52 ` [PATCH] scsi: qedf: " Thomas Meyer
  2018-12-02 20:52 ` [PATCH] scsi: aic7xxx: " Thomas Meyer
  9 siblings, 1 reply; 17+ messages in thread
From: Thomas Meyer @ 2018-12-02 20:52 UTC (permalink / raw)
  To: QLogic-Storage-Upstream, jejb, martin.petersen, linux-scsi,
	linux-kernel

NULL check before some freeing functions is not needed.

Signed-off-by: Thomas Meyer <thomas@m3y3r.de>
---

diff -u -p a/drivers/scsi/qla4xxx/ql4_os.c b/drivers/scsi/qla4xxx/ql4_os.c
--- a/drivers/scsi/qla4xxx/ql4_os.c
+++ b/drivers/scsi/qla4xxx/ql4_os.c
@@ -4160,20 +4160,17 @@ static void qla4xxx_mem_free(struct scsi
 	ha->fw_dump_size = 0;
 
 	/* Free srb pool. */
-	if (ha->srb_mempool)
-		mempool_destroy(ha->srb_mempool);
+	mempool_destroy(ha->srb_mempool);
 
 	ha->srb_mempool = NULL;
 
-	if (ha->chap_dma_pool)
-		dma_pool_destroy(ha->chap_dma_pool);
+	dma_pool_destroy(ha->chap_dma_pool);
 
 	if (ha->chap_list)
 		vfree(ha->chap_list);
 	ha->chap_list = NULL;
 
-	if (ha->fw_ddb_dma_pool)
-		dma_pool_destroy(ha->fw_ddb_dma_pool);
+	dma_pool_destroy(ha->fw_ddb_dma_pool);
 
 	/* release io space registers  */
 	if (is_qla8022(ha)) {

^ permalink raw reply	[flat|nested] 17+ messages in thread

* [PATCH] scsi: NULL check before some freeing functions is not needed.
       [not found] <1543760930050-1499171309-0-diffsplit-thomas@m3y3r.de>
  2018-12-02 20:52 ` [PATCH] scsi: csiostor: NULL check before some freeing functions is not needed Thomas Meyer
  2018-12-02 20:52 ` [PATCH] scsi: ipr: " Thomas Meyer
@ 2018-12-02 20:52 ` Thomas Meyer
  2018-12-02 20:52 ` [PATCH] scsi: qla2xxx: " Thomas Meyer
                   ` (6 subsequent siblings)
  9 siblings, 0 replies; 17+ messages in thread
From: Thomas Meyer @ 2018-12-02 20:52 UTC (permalink / raw)
  To: jejb, martin.petersen, linux-scsi, linux-kernel

NULL check before some freeing functions is not needed.

Signed-off-by: Thomas Meyer <thomas@m3y3r.de>
---

diff -u -p a/drivers/scsi/aic94xx/aic94xx_init.c b/drivers/scsi/aic94xx/aic94xx_init.c
--- a/drivers/scsi/aic94xx/aic94xx_init.c
+++ b/drivers/scsi/aic94xx/aic94xx_init.c
@@ -584,8 +584,7 @@ static void asd_destroy_ha_caches(struct
 	if (asd_ha->hw_prof.scb_ext)
 		asd_free_coherent(asd_ha, asd_ha->hw_prof.scb_ext);
 
-	if (asd_ha->hw_prof.ddb_bitmap)
-		kfree(asd_ha->hw_prof.ddb_bitmap);
+	kfree(asd_ha->hw_prof.ddb_bitmap);
 	asd_ha->hw_prof.ddb_bitmap = NULL;
 
 	for (i = 0; i < ASD_MAX_PHYS; i++) {
@@ -660,12 +659,10 @@ Err:
 
 static void asd_destroy_global_caches(void)
 {
-	if (asd_dma_token_cache)
-		kmem_cache_destroy(asd_dma_token_cache);
+	kmem_cache_destroy(asd_dma_token_cache);
 	asd_dma_token_cache = NULL;
 
-	if (asd_ascb_cache)
-		kmem_cache_destroy(asd_ascb_cache);
+	kmem_cache_destroy(asd_ascb_cache);
 	asd_ascb_cache = NULL;
 }
 

^ permalink raw reply	[flat|nested] 17+ messages in thread

* [PATCH] scsi: lpfc: NULL check before some freeing functions is not needed.
       [not found] <1543760930050-1499171309-0-diffsplit-thomas@m3y3r.de>
                   ` (5 preceding siblings ...)
  2018-12-02 20:52 ` [PATCH] scsi: megaraid_sas: " Thomas Meyer
@ 2018-12-02 20:52 ` Thomas Meyer
  2018-12-02 20:52 ` [PATCH] scsi: qla4xxx: " Thomas Meyer
                   ` (2 subsequent siblings)
  9 siblings, 0 replies; 17+ messages in thread
From: Thomas Meyer @ 2018-12-02 20:52 UTC (permalink / raw)
  To: james.smart, dick.kennedy, jejb, martin.petersen, linux-scsi,
	linux-kernel

NULL check before some freeing functions is not needed.

Signed-off-by: Thomas Meyer <thomas@m3y3r.de>
---

diff -u -p a/drivers/scsi/lpfc/lpfc_bsg.c b/drivers/scsi/lpfc/lpfc_bsg.c
--- a/drivers/scsi/lpfc/lpfc_bsg.c
+++ b/drivers/scsi/lpfc/lpfc_bsg.c
@@ -1276,8 +1276,7 @@ lpfc_bsg_hba_set_event(struct bsg_job *j
 	return 0; /* call job done later */
 
 job_error:
-	if (dd_data != NULL)
-		kfree(dd_data);
+	kfree(dd_data);
 
 	job->dd_data = NULL;
 	return rc;
diff -u -p a/drivers/scsi/lpfc/lpfc_init.c b/drivers/scsi/lpfc/lpfc_init.c
--- a/drivers/scsi/lpfc/lpfc_init.c
+++ b/drivers/scsi/lpfc/lpfc_init.c
@@ -12450,8 +12450,7 @@ lpfc_sli4_oas_verify(struct lpfc_hba *ph
 		phba->cfg_fof = 1;
 	} else {
 		phba->cfg_fof = 0;
-		if (phba->device_data_mem_pool)
-			mempool_destroy(phba->device_data_mem_pool);
+		mempool_destroy(phba->device_data_mem_pool);
 		phba->device_data_mem_pool = NULL;
 	}
 
diff -u -p a/drivers/scsi/lpfc/lpfc_mem.c b/drivers/scsi/lpfc/lpfc_mem.c
--- a/drivers/scsi/lpfc/lpfc_mem.c
+++ b/drivers/scsi/lpfc/lpfc_mem.c
@@ -248,25 +248,19 @@ lpfc_mem_free(struct lpfc_hba *phba)
 
 	/* Free HBQ pools */
 	lpfc_sli_hbqbuf_free_all(phba);
-	if (phba->lpfc_nvmet_drb_pool)
-		dma_pool_destroy(phba->lpfc_nvmet_drb_pool);
+	dma_pool_destroy(phba->lpfc_nvmet_drb_pool);
 	phba->lpfc_nvmet_drb_pool = NULL;
-	if (phba->lpfc_drb_pool)
-		dma_pool_destroy(phba->lpfc_drb_pool);
+	dma_pool_destroy(phba->lpfc_drb_pool);
 	phba->lpfc_drb_pool = NULL;
-	if (phba->lpfc_hrb_pool)
-		dma_pool_destroy(phba->lpfc_hrb_pool);
+	dma_pool_destroy(phba->lpfc_hrb_pool);
 	phba->lpfc_hrb_pool = NULL;
-	if (phba->txrdy_payload_pool)
-		dma_pool_destroy(phba->txrdy_payload_pool);
+	dma_pool_destroy(phba->txrdy_payload_pool);
 	phba->txrdy_payload_pool = NULL;
 
-	if (phba->lpfc_hbq_pool)
-		dma_pool_destroy(phba->lpfc_hbq_pool);
+	dma_pool_destroy(phba->lpfc_hbq_pool);
 	phba->lpfc_hbq_pool = NULL;
 
-	if (phba->rrq_pool)
-		mempool_destroy(phba->rrq_pool);
+	mempool_destroy(phba->rrq_pool);
 	phba->rrq_pool = NULL;
 
 	/* Free NLP memory pool */

^ permalink raw reply	[flat|nested] 17+ messages in thread

* [PATCH] scsi: qla2xxx: NULL check before some freeing functions is not needed.
       [not found] <1543760930050-1499171309-0-diffsplit-thomas@m3y3r.de>
                   ` (2 preceding siblings ...)
  2018-12-02 20:52 ` [PATCH] scsi: " Thomas Meyer
@ 2018-12-02 20:52 ` Thomas Meyer
  2018-12-03 18:07   ` [EXT] " Madhani, Himanshu
  2018-12-08  2:47   ` Martin K. Petersen
  2018-12-02 20:52 ` [PATCH] scsi: mpt3sas: " Thomas Meyer
                   ` (5 subsequent siblings)
  9 siblings, 2 replies; 17+ messages in thread
From: Thomas Meyer @ 2018-12-02 20:52 UTC (permalink / raw)
  To: qla2xxx-upstream, jejb, martin.petersen, linux-scsi, linux-kernel

NULL check before some freeing functions is not needed.

Signed-off-by: Thomas Meyer <thomas@m3y3r.de>
---

diff -u -p a/drivers/scsi/qla2xxx/qla_os.c b/drivers/scsi/qla2xxx/qla_os.c
--- a/drivers/scsi/qla2xxx/qla_os.c
+++ b/drivers/scsi/qla2xxx/qla_os.c
@@ -4191,12 +4191,10 @@ fail_free_nvram:
 	kfree(ha->nvram);
 	ha->nvram = NULL;
 fail_free_ctx_mempool:
-	if (ha->ctx_mempool)
-		mempool_destroy(ha->ctx_mempool);
+	mempool_destroy(ha->ctx_mempool);
 	ha->ctx_mempool = NULL;
 fail_free_srb_mempool:
-	if (ha->srb_mempool)
-		mempool_destroy(ha->srb_mempool);
+	mempool_destroy(ha->srb_mempool);
 	ha->srb_mempool = NULL;
 fail_free_gid_list:
 	dma_free_coherent(&ha->pdev->dev, qla2x00_gid_list_size(ha),
@@ -4498,8 +4496,7 @@ qla2x00_mem_free(struct qla_hw_data *ha)
 		dma_free_coherent(&ha->pdev->dev, MCTP_DUMP_SIZE, ha->mctp_dump,
 		    ha->mctp_dump_dma);
 
-	if (ha->srb_mempool)
-		mempool_destroy(ha->srb_mempool);
+	mempool_destroy(ha->srb_mempool);
 
 	if (ha->dcbx_tlv)
 		dma_free_coherent(&ha->pdev->dev, DCBX_TLV_DATA_SIZE,
@@ -4531,8 +4528,7 @@ qla2x00_mem_free(struct qla_hw_data *ha)
 	if (ha->async_pd)
 		dma_pool_free(ha->s_dma_pool, ha->async_pd, ha->async_pd_dma);
 
-	if (ha->s_dma_pool)
-		dma_pool_destroy(ha->s_dma_pool);
+	dma_pool_destroy(ha->s_dma_pool);
 
 	if (ha->gid_list)
 		dma_free_coherent(&ha->pdev->dev, qla2x00_gid_list_size(ha),
@@ -4553,14 +4549,11 @@ qla2x00_mem_free(struct qla_hw_data *ha)
 		}
 	}
 
-	if (ha->dl_dma_pool)
-		dma_pool_destroy(ha->dl_dma_pool);
+	dma_pool_destroy(ha->dl_dma_pool);
 
-	if (ha->fcp_cmnd_dma_pool)
-		dma_pool_destroy(ha->fcp_cmnd_dma_pool);
+	dma_pool_destroy(ha->fcp_cmnd_dma_pool);
 
-	if (ha->ctx_mempool)
-		mempool_destroy(ha->ctx_mempool);
+	mempool_destroy(ha->ctx_mempool);
 
 	qlt_mem_free(ha);
 
@@ -7106,8 +7099,7 @@ qla2x00_module_exit(void)
 	qla2x00_release_firmware();
 	kmem_cache_destroy(srb_cachep);
 	qlt_exit();
-	if (ctx_cachep)
-		kmem_cache_destroy(ctx_cachep);
+	kmem_cache_destroy(ctx_cachep);
 	fc_release_transport(qla2xxx_transport_template);
 	fc_release_transport(qla2xxx_transport_vport_template);
 }

^ permalink raw reply	[flat|nested] 17+ messages in thread

* [PATCH] scsi: ipr: NULL check before some freeing functions is not needed.
       [not found] <1543760930050-1499171309-0-diffsplit-thomas@m3y3r.de>
  2018-12-02 20:52 ` [PATCH] scsi: csiostor: NULL check before some freeing functions is not needed Thomas Meyer
@ 2018-12-02 20:52 ` Thomas Meyer
  2018-12-02 20:52 ` [PATCH] scsi: " Thomas Meyer
                   ` (7 subsequent siblings)
  9 siblings, 0 replies; 17+ messages in thread
From: Thomas Meyer @ 2018-12-02 20:52 UTC (permalink / raw)
  To: brking, jejb, martin.petersen, linux-scsi, linux-kernel

NULL check before some freeing functions is not needed.

Signed-off-by: Thomas Meyer <thomas@m3y3r.de>
---

diff -u -p a/drivers/scsi/ipr.c b/drivers/scsi/ipr.c
--- a/drivers/scsi/ipr.c
+++ b/drivers/scsi/ipr.c
@@ -9537,8 +9537,7 @@ static void ipr_free_cmd_blks(struct ipr
 		}
 	}
 
-	if (ioa_cfg->ipr_cmd_pool)
-		dma_pool_destroy(ioa_cfg->ipr_cmd_pool);
+	dma_pool_destroy(ioa_cfg->ipr_cmd_pool);
 
 	kfree(ioa_cfg->ipr_cmnd_list);
 	kfree(ioa_cfg->ipr_cmnd_list_dma);

^ permalink raw reply	[flat|nested] 17+ messages in thread

* [PATCH] scsi: aic7xxx: NULL check before some freeing functions is not needed.
       [not found] <1543760930050-1499171309-0-diffsplit-thomas@m3y3r.de>
                   ` (8 preceding siblings ...)
  2018-12-02 20:52 ` [PATCH] scsi: qedf: " Thomas Meyer
@ 2018-12-02 20:52 ` Thomas Meyer
  9 siblings, 0 replies; 17+ messages in thread
From: Thomas Meyer @ 2018-12-02 20:52 UTC (permalink / raw)
  To: hare, jejb, martin.petersen, linux-scsi, linux-kernel

NULL check before some freeing functions is not needed.

Signed-off-by: Thomas Meyer <thomas@m3y3r.de>
---

diff -u -p a/drivers/scsi/aic7xxx/aic79xx_core.c b/drivers/scsi/aic7xxx/aic79xx_core.c
--- a/drivers/scsi/aic7xxx/aic79xx_core.c
+++ b/drivers/scsi/aic7xxx/aic79xx_core.c
@@ -3673,8 +3673,7 @@ ahd_free_tstate(struct ahd_softc *ahd, u
 		return;
 
 	tstate = ahd->enabled_targets[scsi_id];
-	if (tstate != NULL)
-		kfree(tstate);
+	kfree(tstate);
 	ahd->enabled_targets[scsi_id] = NULL;
 }
 #endif
@@ -6136,8 +6135,7 @@ ahd_set_unit(struct ahd_softc *ahd, int
 void
 ahd_set_name(struct ahd_softc *ahd, char *name)
 {
-	if (ahd->name != NULL)
-		kfree(ahd->name);
+	kfree(ahd->name);
 	ahd->name = name;
 }
 
@@ -6198,12 +6196,9 @@ ahd_free(struct ahd_softc *ahd)
 		kfree(ahd->black_hole);
 	}
 #endif
-	if (ahd->name != NULL)
-		kfree(ahd->name);
-	if (ahd->seep_config != NULL)
-		kfree(ahd->seep_config);
-	if (ahd->saved_stack != NULL)
-		kfree(ahd->saved_stack);
+	kfree(ahd->name);
+	kfree(ahd->seep_config);
+	kfree(ahd->saved_stack);
 #ifndef __FreeBSD__
 	kfree(ahd);
 #endif
diff -u -p a/drivers/scsi/aic7xxx/aic7xxx_core.c b/drivers/scsi/aic7xxx/aic7xxx_core.c
--- a/drivers/scsi/aic7xxx/aic7xxx_core.c
+++ b/drivers/scsi/aic7xxx/aic7xxx_core.c
@@ -2193,8 +2193,7 @@ ahc_free_tstate(struct ahc_softc *ahc, u
 	if (channel == 'B')
 		scsi_id += 8;
 	tstate = ahc->enabled_targets[scsi_id];
-	if (tstate != NULL)
-		kfree(tstate);
+	kfree(tstate);
 	ahc->enabled_targets[scsi_id] = NULL;
 }
 #endif
@@ -4474,8 +4473,7 @@ ahc_set_unit(struct ahc_softc *ahc, int
 void
 ahc_set_name(struct ahc_softc *ahc, char *name)
 {
-	if (ahc->name != NULL)
-		kfree(ahc->name);
+	kfree(ahc->name);
 	ahc->name = name;
 }
 
@@ -4536,10 +4534,8 @@ ahc_free(struct ahc_softc *ahc)
 		kfree(ahc->black_hole);
 	}
 #endif
-	if (ahc->name != NULL)
-		kfree(ahc->name);
-	if (ahc->seep_config != NULL)
-		kfree(ahc->seep_config);
+	kfree(ahc->name);
+	kfree(ahc->seep_config);
 #ifndef __FreeBSD__
 	kfree(ahc);
 #endif
@@ -4944,8 +4940,7 @@ ahc_fini_scbdata(struct ahc_softc *ahc)
 	case 0:
 		break;
 	}
-	if (scb_data->scbarray != NULL)
-		kfree(scb_data->scbarray);
+	kfree(scb_data->scbarray);
 }
 
 static void

^ permalink raw reply	[flat|nested] 17+ messages in thread

* [PATCH] scsi: mpt3sas: NULL check before some freeing functions is not needed.
       [not found] <1543760930050-1499171309-0-diffsplit-thomas@m3y3r.de>
                   ` (3 preceding siblings ...)
  2018-12-02 20:52 ` [PATCH] scsi: qla2xxx: " Thomas Meyer
@ 2018-12-02 20:52 ` Thomas Meyer
  2018-12-02 20:52 ` [PATCH] scsi: megaraid_sas: " Thomas Meyer
                   ` (4 subsequent siblings)
  9 siblings, 0 replies; 17+ messages in thread
From: Thomas Meyer @ 2018-12-02 20:52 UTC (permalink / raw)
  To: sathya.prakash, chaitra.basappa, suganath-prabu.subramani, jejb,
	martin.petersen, MPT-FusionLinux.pdl, linux-scsi, linux-kernel

NULL check before some freeing functions is not needed.

Signed-off-by: Thomas Meyer <thomas@m3y3r.de>
---

diff -u -p a/drivers/scsi/mpt3sas/mpt3sas_base.c b/drivers/scsi/mpt3sas/mpt3sas_base.c
--- a/drivers/scsi/mpt3sas/mpt3sas_base.c
+++ b/drivers/scsi/mpt3sas/mpt3sas_base.c
@@ -4213,8 +4213,7 @@ _base_release_memory_pools(struct MPT3SA
 					ioc->pcie_sg_lookup[i].pcie_sgl,
 					ioc->pcie_sg_lookup[i].pcie_sgl_dma);
 		}
-		if (ioc->pcie_sgl_dma_pool)
-			dma_pool_destroy(ioc->pcie_sgl_dma_pool);
+		dma_pool_destroy(ioc->pcie_sgl_dma_pool);
 	}
 
 	if (ioc->config_page) {

^ permalink raw reply	[flat|nested] 17+ messages in thread

* [PATCH] scsi: qedf: NULL check before some freeing functions is not needed.
       [not found] <1543760930050-1499171309-0-diffsplit-thomas@m3y3r.de>
                   ` (7 preceding siblings ...)
  2018-12-02 20:52 ` [PATCH] scsi: qla4xxx: " Thomas Meyer
@ 2018-12-02 20:52 ` Thomas Meyer
  2018-12-03  5:57   ` Rangankar, Manish
  2018-12-08  2:41   ` Martin K. Petersen
  2018-12-02 20:52 ` [PATCH] scsi: aic7xxx: " Thomas Meyer
  9 siblings, 2 replies; 17+ messages in thread
From: Thomas Meyer @ 2018-12-02 20:52 UTC (permalink / raw)
  To: QLogic-Storage-Upstream, jejb, martin.petersen, linux-scsi,
	linux-kernel

NULL check before some freeing functions is not needed.

Signed-off-by: Thomas Meyer <thomas@m3y3r.de>
---

diff -u -p a/drivers/scsi/qedf/qedf_main.c b/drivers/scsi/qedf/qedf_main.c
--- a/drivers/scsi/qedf/qedf_main.c
+++ b/drivers/scsi/qedf/qedf_main.c
@@ -2935,8 +2935,7 @@ static void qedf_free_fcoe_pf_param(stru
 
 	qedf_free_global_queues(qedf);
 
-	if (qedf->global_queues)
-		kfree(qedf->global_queues);
+	kfree(qedf->global_queues);
 }
 
 /*

^ permalink raw reply	[flat|nested] 17+ messages in thread

* [PATCH] scsi: megaraid_sas: NULL check before some freeing functions is not needed.
       [not found] <1543760930050-1499171309-0-diffsplit-thomas@m3y3r.de>
                   ` (4 preceding siblings ...)
  2018-12-02 20:52 ` [PATCH] scsi: mpt3sas: " Thomas Meyer
@ 2018-12-02 20:52 ` Thomas Meyer
  2018-12-03  6:40   ` Sumit Saxena
  2018-12-08  2:40   ` Martin K. Petersen
  2018-12-02 20:52 ` [PATCH] scsi: lpfc: " Thomas Meyer
                   ` (3 subsequent siblings)
  9 siblings, 2 replies; 17+ messages in thread
From: Thomas Meyer @ 2018-12-02 20:52 UTC (permalink / raw)
  To: kashyap.desai, sumit.saxena, shivasharan.srikanteshwara, jejb,
	martin.petersen, megaraidlinux.pdl, linux-scsi, linux-kernel

NULL check before some freeing functions is not needed.

Signed-off-by: Thomas Meyer <thomas@m3y3r.de>
---

diff -u -p a/drivers/scsi/megaraid/megaraid_mbox.c b/drivers/scsi/megaraid/megaraid_mbox.c
--- a/drivers/scsi/megaraid/megaraid_mbox.c
+++ b/drivers/scsi/megaraid/megaraid_mbox.c
@@ -1243,8 +1243,7 @@ megaraid_mbox_teardown_dma_pools(adapter
 		dma_pool_free(raid_dev->sg_pool_handle, sg_pci_blk[i].vaddr,
 			sg_pci_blk[i].dma_addr);
 	}
-	if (raid_dev->sg_pool_handle)
-		dma_pool_destroy(raid_dev->sg_pool_handle);
+	dma_pool_destroy(raid_dev->sg_pool_handle);
 
 
 	epthru_pci_blk = raid_dev->epthru_pool;
@@ -1252,8 +1251,7 @@ megaraid_mbox_teardown_dma_pools(adapter
 		dma_pool_free(raid_dev->epthru_pool_handle,
 			epthru_pci_blk[i].vaddr, epthru_pci_blk[i].dma_addr);
 	}
-	if (raid_dev->epthru_pool_handle)
-		dma_pool_destroy(raid_dev->epthru_pool_handle);
+	dma_pool_destroy(raid_dev->epthru_pool_handle);
 
 
 	mbox_pci_blk = raid_dev->mbox_pool;
@@ -1261,8 +1259,7 @@ megaraid_mbox_teardown_dma_pools(adapter
 		dma_pool_free(raid_dev->mbox_pool_handle,
 			mbox_pci_blk[i].vaddr, mbox_pci_blk[i].dma_addr);
 	}
-	if (raid_dev->mbox_pool_handle)
-		dma_pool_destroy(raid_dev->mbox_pool_handle);
+	dma_pool_destroy(raid_dev->mbox_pool_handle);
 
 	return;
 }
diff -u -p a/drivers/scsi/megaraid/megaraid_mm.c b/drivers/scsi/megaraid/megaraid_mm.c
--- a/drivers/scsi/megaraid/megaraid_mm.c
+++ b/drivers/scsi/megaraid/megaraid_mm.c
@@ -1017,8 +1017,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);
 
diff -u -p a/drivers/scsi/megaraid/megaraid_sas_fusion.c b/drivers/scsi/megaraid/megaraid_sas_fusion.c
--- a/drivers/scsi/megaraid/megaraid_sas_fusion.c
+++ b/drivers/scsi/megaraid/megaraid_sas_fusion.c
@@ -807,10 +807,8 @@ megasas_free_rdpq_fusion(struct megasas_
 
 	}
 
-	if (fusion->reply_frames_desc_pool)
-		dma_pool_destroy(fusion->reply_frames_desc_pool);
-	if (fusion->reply_frames_desc_pool_align)
-		dma_pool_destroy(fusion->reply_frames_desc_pool_align);
+	dma_pool_destroy(fusion->reply_frames_desc_pool);
+	dma_pool_destroy(fusion->reply_frames_desc_pool_align);
 
 	if (fusion->rdpq_virt)
 		dma_free_coherent(&instance->pdev->dev,
@@ -830,8 +828,7 @@ megasas_free_reply_fusion(struct megasas
 			fusion->reply_frames_desc[0],
 			fusion->reply_frames_desc_phys[0]);
 
-	if (fusion->reply_frames_desc_pool)
-		dma_pool_destroy(fusion->reply_frames_desc_pool);
+	dma_pool_destroy(fusion->reply_frames_desc_pool);
 
 }
 
@@ -1627,8 +1624,7 @@ static inline void megasas_free_ioc_init
 				  fusion->ioc_init_cmd->frame,
 				  fusion->ioc_init_cmd->frame_phys_addr);
 
-	if (fusion->ioc_init_cmd)
-		kfree(fusion->ioc_init_cmd);
+	kfree(fusion->ioc_init_cmd);
 }
 
 /**

^ permalink raw reply	[flat|nested] 17+ messages in thread

* RE: [PATCH] scsi: qla4xxx: NULL check before some freeing functions is not needed.
  2018-12-02 20:52 ` [PATCH] scsi: qla4xxx: " Thomas Meyer
@ 2018-12-03  5:48   ` Rangankar, Manish
  0 siblings, 0 replies; 17+ messages in thread
From: Rangankar, Manish @ 2018-12-03  5:48 UTC (permalink / raw)
  To: Thomas Meyer, Dept-Eng QLogic Storage Upstream,
	jejb@linux.vnet.ibm.com, martin.petersen@oracle.com,
	linux-scsi@vger.kernel.org, linux-kernel@vger.kernel.org


> -----Original Message-----
> From: Thomas Meyer <thomas@m3y3r.de>
> Sent: Monday, December 3, 2018 2:22 AM
> To: Dept-Eng QLogic Storage Upstream <QLogic-Storage-
> Upstream@cavium.com>; jejb@linux.vnet.ibm.com;
> martin.petersen@oracle.com; linux-scsi@vger.kernel.org; linux-
> kernel@vger.kernel.org
> Subject: [PATCH] scsi: qla4xxx: NULL check before some freeing functions is not
> needed.
> 
> External Email
> 
> NULL check before some freeing functions is not needed.
> 
> Signed-off-by: Thomas Meyer <thomas@m3y3r.de>
> ---
> 
> diff -u -p a/drivers/scsi/qla4xxx/ql4_os.c b/drivers/scsi/qla4xxx/ql4_os.c
> --- a/drivers/scsi/qla4xxx/ql4_os.c
> +++ b/drivers/scsi/qla4xxx/ql4_os.c
> @@ -4160,20 +4160,17 @@ static void qla4xxx_mem_free(struct scsi
>         ha->fw_dump_size = 0;
> 
>         /* Free srb pool. */
> -       if (ha->srb_mempool)
> -               mempool_destroy(ha->srb_mempool);
> +       mempool_destroy(ha->srb_mempool);
> 
>         ha->srb_mempool = NULL;
> 
> -       if (ha->chap_dma_pool)
> -               dma_pool_destroy(ha->chap_dma_pool);
> +       dma_pool_destroy(ha->chap_dma_pool);
> 
>         if (ha->chap_list)
>                 vfree(ha->chap_list);
>         ha->chap_list = NULL;
> 
> -       if (ha->fw_ddb_dma_pool)
> -               dma_pool_destroy(ha->fw_ddb_dma_pool);
> +       dma_pool_destroy(ha->fw_ddb_dma_pool);
> 
>         /* release io space registers  */
>         if (is_qla8022(ha)) {

Thanks
Acked-by: Manish Rangankar <Manish.Rangankar@cavium.com>

^ permalink raw reply	[flat|nested] 17+ messages in thread

* RE: [PATCH] scsi: qedf: NULL check before some freeing functions is not needed.
  2018-12-02 20:52 ` [PATCH] scsi: qedf: " Thomas Meyer
@ 2018-12-03  5:57   ` Rangankar, Manish
  2018-12-08  2:41   ` Martin K. Petersen
  1 sibling, 0 replies; 17+ messages in thread
From: Rangankar, Manish @ 2018-12-03  5:57 UTC (permalink / raw)
  To: Thomas Meyer, Dept-Eng QLogic Storage Upstream,
	jejb@linux.vnet.ibm.com, martin.petersen@oracle.com,
	linux-scsi@vger.kernel.org, linux-kernel@vger.kernel.org


> -----Original Message-----
> From: Thomas Meyer <thomas@m3y3r.de>
> Sent: Monday, December 3, 2018 2:22 AM
> To: Dept-Eng QLogic Storage Upstream <QLogic-Storage-
> Upstream@cavium.com>; jejb@linux.vnet.ibm.com;
> martin.petersen@oracle.com; linux-scsi@vger.kernel.org; linux-
> kernel@vger.kernel.org
> Subject: [PATCH] scsi: qedf: NULL check before some freeing functions is not
> needed.
> 
> External Email
> 
> NULL check before some freeing functions is not needed.
> 
> Signed-off-by: Thomas Meyer <thomas@m3y3r.de>
> ---
> 
> diff -u -p a/drivers/scsi/qedf/qedf_main.c b/drivers/scsi/qedf/qedf_main.c
> --- a/drivers/scsi/qedf/qedf_main.c
> +++ b/drivers/scsi/qedf/qedf_main.c
> @@ -2935,8 +2935,7 @@ static void qedf_free_fcoe_pf_param(stru
> 
>         qedf_free_global_queues(qedf);
> 
> -       if (qedf->global_queues)
> -               kfree(qedf->global_queues);
> +       kfree(qedf->global_queues);
>  }
> 
>  /*

Thanks
Acked-by: Manish Rangankar <Manish.Rangankar@cavium.com>

^ permalink raw reply	[flat|nested] 17+ messages in thread

* Re: [PATCH] scsi: megaraid_sas: NULL check before some freeing functions is not needed.
  2018-12-02 20:52 ` [PATCH] scsi: megaraid_sas: " Thomas Meyer
@ 2018-12-03  6:40   ` Sumit Saxena
  2018-12-08  2:40   ` Martin K. Petersen
  1 sibling, 0 replies; 17+ messages in thread
From: Sumit Saxena @ 2018-12-03  6:40 UTC (permalink / raw)
  To: thomas
  Cc: Kashyap Desai, Shivasharan Srikanteshwara, James E. J. Bottomley,
	Martin K. Petersen, megaraidlinux.pdl, Linux SCSI List, LKML

On Mon, Dec 3, 2018 at 2:25 AM Thomas Meyer <thomas@m3y3r.de> wrote:
>
> NULL check before some freeing functions is not needed.
>
> Signed-off-by: Thomas Meyer <thomas@m3y3r.de>

Acked-by: Sumit Saxena <sumit.saxena@broadcom.com>

> ---
>
> diff -u -p a/drivers/scsi/megaraid/megaraid_mbox.c b/drivers/scsi/megaraid/megaraid_mbox.c
> --- a/drivers/scsi/megaraid/megaraid_mbox.c
> +++ b/drivers/scsi/megaraid/megaraid_mbox.c
> @@ -1243,8 +1243,7 @@ megaraid_mbox_teardown_dma_pools(adapter
>                 dma_pool_free(raid_dev->sg_pool_handle, sg_pci_blk[i].vaddr,
>                         sg_pci_blk[i].dma_addr);
>         }
> -       if (raid_dev->sg_pool_handle)
> -               dma_pool_destroy(raid_dev->sg_pool_handle);
> +       dma_pool_destroy(raid_dev->sg_pool_handle);
>
>
>         epthru_pci_blk = raid_dev->epthru_pool;
> @@ -1252,8 +1251,7 @@ megaraid_mbox_teardown_dma_pools(adapter
>                 dma_pool_free(raid_dev->epthru_pool_handle,
>                         epthru_pci_blk[i].vaddr, epthru_pci_blk[i].dma_addr);
>         }
> -       if (raid_dev->epthru_pool_handle)
> -               dma_pool_destroy(raid_dev->epthru_pool_handle);
> +       dma_pool_destroy(raid_dev->epthru_pool_handle);
>
>
>         mbox_pci_blk = raid_dev->mbox_pool;
> @@ -1261,8 +1259,7 @@ megaraid_mbox_teardown_dma_pools(adapter
>                 dma_pool_free(raid_dev->mbox_pool_handle,
>                         mbox_pci_blk[i].vaddr, mbox_pci_blk[i].dma_addr);
>         }
> -       if (raid_dev->mbox_pool_handle)
> -               dma_pool_destroy(raid_dev->mbox_pool_handle);
> +       dma_pool_destroy(raid_dev->mbox_pool_handle);
>
>         return;
>  }
> diff -u -p a/drivers/scsi/megaraid/megaraid_mm.c b/drivers/scsi/megaraid/megaraid_mm.c
> --- a/drivers/scsi/megaraid/megaraid_mm.c
> +++ b/drivers/scsi/megaraid/megaraid_mm.c
> @@ -1017,8 +1017,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);
>
> diff -u -p a/drivers/scsi/megaraid/megaraid_sas_fusion.c b/drivers/scsi/megaraid/megaraid_sas_fusion.c
> --- a/drivers/scsi/megaraid/megaraid_sas_fusion.c
> +++ b/drivers/scsi/megaraid/megaraid_sas_fusion.c
> @@ -807,10 +807,8 @@ megasas_free_rdpq_fusion(struct megasas_
>
>         }
>
> -       if (fusion->reply_frames_desc_pool)
> -               dma_pool_destroy(fusion->reply_frames_desc_pool);
> -       if (fusion->reply_frames_desc_pool_align)
> -               dma_pool_destroy(fusion->reply_frames_desc_pool_align);
> +       dma_pool_destroy(fusion->reply_frames_desc_pool);
> +       dma_pool_destroy(fusion->reply_frames_desc_pool_align);
>
>         if (fusion->rdpq_virt)
>                 dma_free_coherent(&instance->pdev->dev,
> @@ -830,8 +828,7 @@ megasas_free_reply_fusion(struct megasas
>                         fusion->reply_frames_desc[0],
>                         fusion->reply_frames_desc_phys[0]);
>
> -       if (fusion->reply_frames_desc_pool)
> -               dma_pool_destroy(fusion->reply_frames_desc_pool);
> +       dma_pool_destroy(fusion->reply_frames_desc_pool);
>
>  }
>
> @@ -1627,8 +1624,7 @@ static inline void megasas_free_ioc_init
>                                   fusion->ioc_init_cmd->frame,
>                                   fusion->ioc_init_cmd->frame_phys_addr);
>
> -       if (fusion->ioc_init_cmd)
> -               kfree(fusion->ioc_init_cmd);
> +       kfree(fusion->ioc_init_cmd);
>  }
>
>  /**
>
>

^ permalink raw reply	[flat|nested] 17+ messages in thread

* Re: [EXT] [PATCH] scsi: qla2xxx: NULL check before some freeing functions is not needed.
  2018-12-02 20:52 ` [PATCH] scsi: qla2xxx: " Thomas Meyer
@ 2018-12-03 18:07   ` Madhani, Himanshu
  2018-12-08  2:47   ` Martin K. Petersen
  1 sibling, 0 replies; 17+ messages in thread
From: Madhani, Himanshu @ 2018-12-03 18:07 UTC (permalink / raw)
  To: Thomas Meyer
  Cc: Dept-Eng QLA2xxx Upstream, James E . J . Bottomley,
	Martin K . Petersen, linux-scsi, linux-kernel@vger.kernel.org


> On Dec 2, 2018, at 12:52 PM, Thomas Meyer <thomas@m3y3r.de> wrote:
> 
> External Email
> 
> ----------------------------------------------------------------------
> External Email
> 
> NULL check before some freeing functions is not needed.
> 
> Signed-off-by: Thomas Meyer <thomas@m3y3r.de>
> ---
> 
> diff -u -p a/drivers/scsi/qla2xxx/qla_os.c b/drivers/scsi/qla2xxx/qla_os.c
> --- a/drivers/scsi/qla2xxx/qla_os.c
> +++ b/drivers/scsi/qla2xxx/qla_os.c
> @@ -4191,12 +4191,10 @@ fail_free_nvram:
>        kfree(ha->nvram);
>        ha->nvram = NULL;
> fail_free_ctx_mempool:
> -       if (ha->ctx_mempool)
> -               mempool_destroy(ha->ctx_mempool);
> +       mempool_destroy(ha->ctx_mempool);
>        ha->ctx_mempool = NULL;
> fail_free_srb_mempool:
> -       if (ha->srb_mempool)
> -               mempool_destroy(ha->srb_mempool);
> +       mempool_destroy(ha->srb_mempool);
>        ha->srb_mempool = NULL;
> fail_free_gid_list:
>        dma_free_coherent(&ha->pdev->dev, qla2x00_gid_list_size(ha),
> @@ -4498,8 +4496,7 @@ qla2x00_mem_free(struct qla_hw_data *ha)
>                dma_free_coherent(&ha->pdev->dev, MCTP_DUMP_SIZE, ha->mctp_dump,
>                    ha->mctp_dump_dma);
> 
> -       if (ha->srb_mempool)
> -               mempool_destroy(ha->srb_mempool);
> +       mempool_destroy(ha->srb_mempool);
> 
>        if (ha->dcbx_tlv)
>                dma_free_coherent(&ha->pdev->dev, DCBX_TLV_DATA_SIZE,
> @@ -4531,8 +4528,7 @@ qla2x00_mem_free(struct qla_hw_data *ha)
>        if (ha->async_pd)
>                dma_pool_free(ha->s_dma_pool, ha->async_pd, ha->async_pd_dma);
> 
> -       if (ha->s_dma_pool)
> -               dma_pool_destroy(ha->s_dma_pool);
> +       dma_pool_destroy(ha->s_dma_pool);
> 
>        if (ha->gid_list)
>                dma_free_coherent(&ha->pdev->dev, qla2x00_gid_list_size(ha),
> @@ -4553,14 +4549,11 @@ qla2x00_mem_free(struct qla_hw_data *ha)
>                }
>        }
> 
> -       if (ha->dl_dma_pool)
> -               dma_pool_destroy(ha->dl_dma_pool);
> +       dma_pool_destroy(ha->dl_dma_pool);
> 
> -       if (ha->fcp_cmnd_dma_pool)
> -               dma_pool_destroy(ha->fcp_cmnd_dma_pool);
> +       dma_pool_destroy(ha->fcp_cmnd_dma_pool);
> 
> -       if (ha->ctx_mempool)
> -               mempool_destroy(ha->ctx_mempool);
> +       mempool_destroy(ha->ctx_mempool);
> 
>        qlt_mem_free(ha);
> 
> @@ -7106,8 +7099,7 @@ qla2x00_module_exit(void)
>        qla2x00_release_firmware();
>        kmem_cache_destroy(srb_cachep);
>        qlt_exit();
> -       if (ctx_cachep)
> -               kmem_cache_destroy(ctx_cachep);
> +       kmem_cache_destroy(ctx_cachep);
>        fc_release_transport(qla2xxx_transport_template);
>        fc_release_transport(qla2xxx_transport_vport_template);
> }

Looks good. 

Acked-by: Himanshu Madhani <hmadhani@marvell.com>

Thanks,
- Himanshu

^ permalink raw reply	[flat|nested] 17+ messages in thread

* Re: [PATCH] scsi: megaraid_sas: NULL check before some freeing functions is not needed.
  2018-12-02 20:52 ` [PATCH] scsi: megaraid_sas: " Thomas Meyer
  2018-12-03  6:40   ` Sumit Saxena
@ 2018-12-08  2:40   ` Martin K. Petersen
  1 sibling, 0 replies; 17+ messages in thread
From: Martin K. Petersen @ 2018-12-08  2:40 UTC (permalink / raw)
  To: Thomas Meyer
  Cc: kashyap.desai, sumit.saxena, shivasharan.srikanteshwara, jejb,
	martin.petersen, megaraidlinux.pdl, linux-scsi, linux-kernel


Thomas,

> NULL check before some freeing functions is not needed.

Applied to 4.21/scsi-queue.

-- 
Martin K. Petersen	Oracle Linux Engineering

^ permalink raw reply	[flat|nested] 17+ messages in thread

* Re: [PATCH] scsi: qedf: NULL check before some freeing functions is not needed.
  2018-12-02 20:52 ` [PATCH] scsi: qedf: " Thomas Meyer
  2018-12-03  5:57   ` Rangankar, Manish
@ 2018-12-08  2:41   ` Martin K. Petersen
  1 sibling, 0 replies; 17+ messages in thread
From: Martin K. Petersen @ 2018-12-08  2:41 UTC (permalink / raw)
  To: Thomas Meyer
  Cc: QLogic-Storage-Upstream, jejb, martin.petersen, linux-scsi,
	linux-kernel


Thomas,

> NULL check before some freeing functions is not needed.

Applied to 4.21/scsi-queue, thanks.

-- 
Martin K. Petersen	Oracle Linux Engineering

^ permalink raw reply	[flat|nested] 17+ messages in thread

* Re: [PATCH] scsi: qla2xxx: NULL check before some freeing functions is not needed.
  2018-12-02 20:52 ` [PATCH] scsi: qla2xxx: " Thomas Meyer
  2018-12-03 18:07   ` [EXT] " Madhani, Himanshu
@ 2018-12-08  2:47   ` Martin K. Petersen
  1 sibling, 0 replies; 17+ messages in thread
From: Martin K. Petersen @ 2018-12-08  2:47 UTC (permalink / raw)
  To: Thomas Meyer
  Cc: qla2xxx-upstream, jejb, martin.petersen, linux-scsi, linux-kernel


Thomas,

> NULL check before some freeing functions is not needed.

Applied to 4.21/scsi-queue.

-- 
Martin K. Petersen	Oracle Linux Engineering

^ permalink raw reply	[flat|nested] 17+ messages in thread

end of thread, other threads:[~2018-12-08  2:47 UTC | newest]

Thread overview: 17+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
     [not found] <1543760930050-1499171309-0-diffsplit-thomas@m3y3r.de>
2018-12-02 20:52 ` [PATCH] scsi: csiostor: NULL check before some freeing functions is not needed Thomas Meyer
2018-12-02 20:52 ` [PATCH] scsi: ipr: " Thomas Meyer
2018-12-02 20:52 ` [PATCH] scsi: " Thomas Meyer
2018-12-02 20:52 ` [PATCH] scsi: qla2xxx: " Thomas Meyer
2018-12-03 18:07   ` [EXT] " Madhani, Himanshu
2018-12-08  2:47   ` Martin K. Petersen
2018-12-02 20:52 ` [PATCH] scsi: mpt3sas: " Thomas Meyer
2018-12-02 20:52 ` [PATCH] scsi: megaraid_sas: " Thomas Meyer
2018-12-03  6:40   ` Sumit Saxena
2018-12-08  2:40   ` Martin K. Petersen
2018-12-02 20:52 ` [PATCH] scsi: lpfc: " Thomas Meyer
2018-12-02 20:52 ` [PATCH] scsi: qla4xxx: " Thomas Meyer
2018-12-03  5:48   ` Rangankar, Manish
2018-12-02 20:52 ` [PATCH] scsi: qedf: " Thomas Meyer
2018-12-03  5:57   ` Rangankar, Manish
2018-12-08  2:41   ` Martin K. Petersen
2018-12-02 20:52 ` [PATCH] scsi: aic7xxx: " Thomas Meyer

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).