All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH] scsi: csiostor: NULL check before some freeing functions is not needed.
  2018-12-02 20:52 Cocci spatch "ifnullfree" - v4.20-rc4 Thomas Meyer
                   ` (14 preceding siblings ...)
  2018-12-02 20:52 ` [PATCH] scsi: ipr: " Thomas Meyer
@ 2018-12-02 20:52 ` Thomas Meyer
  15 siblings, 0 replies; 37+ 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] 37+ messages in thread

* [PATCH] KVM: PPC: Book3S HV: NULL check before some freeing functions is not needed.
  2018-12-02 20:52 Cocci spatch "ifnullfree" - v4.20-rc4 Thomas Meyer
@ 2018-12-02 20:52   ` Thomas Meyer
  2018-12-02 20:52 ` [PATCH] drm/amdgpu: " Thomas Meyer
                     ` (14 subsequent siblings)
  15 siblings, 0 replies; 37+ messages in thread
From: Thomas Meyer @ 2018-12-02 20:52 UTC (permalink / raw)
  To: paulus, benh, mpe, kvm-ppc, linuxppc-dev, linux-kernel

NULL check before some freeing functions is not needed.

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

diff -u -p a/arch/powerpc/kvm/book3s_hv_nested.c b/arch/powerpc/kvm/book3s_hv_nested.c
--- a/arch/powerpc/kvm/book3s_hv_nested.c
+++ b/arch/powerpc/kvm/book3s_hv_nested.c
@@ -1252,8 +1252,7 @@ static long int __kvmhv_nested_page_faul
 	rmapp = &memslot->arch.rmap[gfn - memslot->base_gfn];
 	ret = kvmppc_create_pte(kvm, gp->shadow_pgtable, pte, n_gpa, level,
 				mmu_seq, gp->shadow_lpid, rmapp, &n_rmap);
-	if (n_rmap)
-		kfree(n_rmap);
+	kfree(n_rmap);
 	if (ret == -EAGAIN)
 		ret = RESUME_GUEST;	/* Let the guest try again */
 

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

* [PATCH] scsi: qla4xxx: NULL check before some freeing functions is not needed.
  2018-12-02 20:52 Cocci spatch "ifnullfree" - v4.20-rc4 Thomas Meyer
                   ` (8 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
                   ` (5 subsequent siblings)
  15 siblings, 1 reply; 37+ 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] 37+ messages in thread

* [PATCH] scsi: NULL check before some freeing functions is not needed.
  2018-12-02 20:52 Cocci spatch "ifnullfree" - v4.20-rc4 Thomas Meyer
@ 2018-12-02 20:52 ` Thomas Meyer
  2018-12-02 20:52 ` [PATCH] drm/amdgpu: " Thomas Meyer
                   ` (14 subsequent siblings)
  15 siblings, 0 replies; 37+ 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] 37+ messages in thread

* [PATCH] scsi: lpfc: NULL check before some freeing functions is not needed.
  2018-12-02 20:52 Cocci spatch "ifnullfree" - v4.20-rc4 Thomas Meyer
                   ` (7 preceding siblings ...)
  2018-12-02 20:52 ` [PATCH] PM / AVS: SmartReflex: " Thomas Meyer
@ 2018-12-02 20:52 ` Thomas Meyer
  2018-12-02 20:52 ` [PATCH] scsi: qla4xxx: " Thomas Meyer
                   ` (6 subsequent siblings)
  15 siblings, 0 replies; 37+ 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] 37+ messages in thread

* Cocci spatch "ifnullfree" - v4.20-rc4
@ 2018-12-02 20:52 Thomas Meyer
  2018-12-02 20:52 ` [PATCH] scsi: NULL check before some freeing functions is not needed Thomas Meyer
                   ` (15 more replies)
  0 siblings, 16 replies; 37+ messages in thread
From: Thomas Meyer @ 2018-12-02 20:52 UTC (permalink / raw)
  To: linux-kernel

NULL check before some freeing functions is not needed.

Found by coccinelle spatch "free/ifnullfree.cocci"

Run against version v4.20-rc4

P.S. If you find this email unwanted, set up a procmail rule junking on
the header:

X-Patch: Cocci

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

* [PATCH] scsi: qla2xxx: NULL check before some freeing functions is not needed.
  2018-12-02 20:52 Cocci spatch "ifnullfree" - v4.20-rc4 Thomas Meyer
                   ` (12 preceding siblings ...)
  2018-12-02 20:52 ` [PATCH] platform/x86: intel_ips: " 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: ipr: " Thomas Meyer
  2018-12-02 20:52 ` [PATCH] scsi: csiostor: " Thomas Meyer
  15 siblings, 2 replies; 37+ 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] 37+ messages in thread

* [PATCH] scsi: ipr: NULL check before some freeing functions is not needed.
  2018-12-02 20:52 Cocci spatch "ifnullfree" - v4.20-rc4 Thomas Meyer
                   ` (13 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: csiostor: " Thomas Meyer
  15 siblings, 0 replies; 37+ 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] 37+ messages in thread

* [PATCH] drm/amdgpu: NULL check before some freeing functions is not needed.
  2018-12-02 20:52 Cocci spatch "ifnullfree" - v4.20-rc4 Thomas Meyer
  2018-12-02 20:52 ` [PATCH] scsi: NULL check before some freeing functions is not needed Thomas Meyer
@ 2018-12-02 20:52 ` Thomas Meyer
  2018-12-03 11:51   ` Koenig, Christian
  2018-12-02 20:52 ` [PATCH] scsi: aic7xxx: " Thomas Meyer
                   ` (13 subsequent siblings)
  15 siblings, 1 reply; 37+ messages in thread
From: Thomas Meyer @ 2018-12-02 20:52 UTC (permalink / raw)
  To: alexander.deucher, christian.koenig, David1.Zhou, airlied,
	amd-gfx, dri-devel, linux-kernel

NULL check before some freeing functions is not needed.

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

diff -u -p a/drivers/gpu/drm/amd/amdgpu/amdgpu_acpi.c b/drivers/gpu/drm/amd/amdgpu/amdgpu_acpi.c
--- a/drivers/gpu/drm/amd/amdgpu/amdgpu_acpi.c
+++ b/drivers/gpu/drm/amd/amdgpu/amdgpu_acpi.c
@@ -816,6 +816,5 @@ out:
 void amdgpu_acpi_fini(struct amdgpu_device *adev)
 {
 	unregister_acpi_notifier(&adev->acpi_nb);
-	if (adev->atif)
-		kfree(adev->atif);
+	kfree(adev->atif);
 }

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

* [PATCH] PM / AVS: SmartReflex: NULL check before some freeing functions is not needed.
  2018-12-02 20:52 Cocci spatch "ifnullfree" - v4.20-rc4 Thomas Meyer
                   ` (6 preceding siblings ...)
  2018-12-02 20:52   ` Thomas Meyer
@ 2018-12-02 20:52 ` Thomas Meyer
  2018-12-11 18:53   ` Kevin Hilman
  2018-12-02 20:52 ` [PATCH] scsi: lpfc: " Thomas Meyer
                   ` (7 subsequent siblings)
  15 siblings, 1 reply; 37+ messages in thread
From: Thomas Meyer @ 2018-12-02 20:52 UTC (permalink / raw)
  To: khilman, nm, linux-pm, linux-kernel

NULL check before some freeing functions is not needed.

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

diff -u -p a/drivers/power/avs/smartreflex.c b/drivers/power/avs/smartreflex.c
--- a/drivers/power/avs/smartreflex.c
+++ b/drivers/power/avs/smartreflex.c
@@ -1010,8 +1010,7 @@ static int omap_sr_remove(struct platfor
 
 	if (sr_info->autocomp_active)
 		sr_stop_vddautocomp(sr_info);
-	if (sr_info->dbg_dir)
-		debugfs_remove_recursive(sr_info->dbg_dir);
+	debugfs_remove_recursive(sr_info->dbg_dir);
 
 	pm_runtime_disable(&pdev->dev);
 	list_del(&sr_info->node);

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

* [PATCH] scsi: aic7xxx: NULL check before some freeing functions is not needed.
  2018-12-02 20:52 Cocci spatch "ifnullfree" - v4.20-rc4 Thomas Meyer
  2018-12-02 20:52 ` [PATCH] scsi: NULL check before some freeing functions is not needed Thomas Meyer
  2018-12-02 20:52 ` [PATCH] drm/amdgpu: " Thomas Meyer
@ 2018-12-02 20:52 ` Thomas Meyer
  2018-12-02 20:52   ` [Cluster-devel] " Thomas Meyer
                   ` (12 subsequent siblings)
  15 siblings, 0 replies; 37+ 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] 37+ messages in thread

* [PATCH] [SCSI] zfcp: NULL check before some freeing functions is not needed.
  2018-12-02 20:52 Cocci spatch "ifnullfree" - v4.20-rc4 Thomas Meyer
                   ` (3 preceding siblings ...)
  2018-12-02 20:52   ` [Cluster-devel] " Thomas Meyer
@ 2018-12-02 20:52 ` Thomas Meyer
  2018-12-03 10:59   ` Steffen Maier
  2018-12-02 20:52 ` [PATCH] scsi: megaraid_sas: " Thomas Meyer
                   ` (10 subsequent siblings)
  15 siblings, 1 reply; 37+ messages in thread
From: Thomas Meyer @ 2018-12-02 20:52 UTC (permalink / raw)
  To: maier, bblock, schwidefsky, heiko.carstens, linux-s390, linux-kernel

NULL check before some freeing functions is not needed.

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

diff -u -p a/drivers/s390/scsi/zfcp_aux.c b/drivers/s390/scsi/zfcp_aux.c
--- a/drivers/s390/scsi/zfcp_aux.c
+++ b/drivers/s390/scsi/zfcp_aux.c
@@ -248,20 +248,13 @@ static int zfcp_allocate_low_mem_buffers
 
 static void zfcp_free_low_mem_buffers(struct zfcp_adapter *adapter)
 {
-	if (adapter->pool.erp_req)
-		mempool_destroy(adapter->pool.erp_req);
-	if (adapter->pool.scsi_req)
-		mempool_destroy(adapter->pool.scsi_req);
-	if (adapter->pool.scsi_abort)
-		mempool_destroy(adapter->pool.scsi_abort);
-	if (adapter->pool.qtcb_pool)
-		mempool_destroy(adapter->pool.qtcb_pool);
-	if (adapter->pool.status_read_req)
-		mempool_destroy(adapter->pool.status_read_req);
-	if (adapter->pool.sr_data)
-		mempool_destroy(adapter->pool.sr_data);
-	if (adapter->pool.gid_pn)
-		mempool_destroy(adapter->pool.gid_pn);
+	mempool_destroy(adapter->pool.erp_req);
+	mempool_destroy(adapter->pool.scsi_req);
+	mempool_destroy(adapter->pool.scsi_abort);
+	mempool_destroy(adapter->pool.qtcb_pool);
+	mempool_destroy(adapter->pool.status_read_req);
+	mempool_destroy(adapter->pool.sr_data);
+	mempool_destroy(adapter->pool.gid_pn);
 }
 
 /**

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

* [PATCH] scsi: mpt3sas: NULL check before some freeing functions is not needed.
  2018-12-02 20:52 Cocci spatch "ifnullfree" - v4.20-rc4 Thomas Meyer
                   ` (10 preceding siblings ...)
  2018-12-02 20:52 ` [PATCH] scsi: qedf: " Thomas Meyer
@ 2018-12-02 20:52 ` Thomas Meyer
  2018-12-02 20:52 ` [PATCH] platform/x86: intel_ips: " Thomas Meyer
                   ` (3 subsequent siblings)
  15 siblings, 0 replies; 37+ 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] 37+ messages in thread

* [PATCH] scsi: qedf: NULL check before some freeing functions is not needed.
  2018-12-02 20:52 Cocci spatch "ifnullfree" - v4.20-rc4 Thomas Meyer
                   ` (9 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: mpt3sas: " Thomas Meyer
                   ` (4 subsequent siblings)
  15 siblings, 2 replies; 37+ 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] 37+ messages in thread

* [PATCH] scsi: megaraid_sas: NULL check before some freeing functions is not needed.
  2018-12-02 20:52 Cocci spatch "ifnullfree" - v4.20-rc4 Thomas Meyer
                   ` (4 preceding siblings ...)
  2018-12-02 20:52 ` [PATCH] [SCSI] zfcp: " 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   ` Thomas Meyer
                   ` (9 subsequent siblings)
  15 siblings, 2 replies; 37+ 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] 37+ messages in thread

* [PATCH] platform/x86: intel_ips: NULL check before some freeing functions is not needed.
  2018-12-02 20:52 Cocci spatch "ifnullfree" - v4.20-rc4 Thomas Meyer
                   ` (11 preceding siblings ...)
  2018-12-02 20:52 ` [PATCH] scsi: mpt3sas: " Thomas Meyer
@ 2018-12-02 20:52 ` Thomas Meyer
  2018-12-03 19:10   ` Andy Shevchenko
  2018-12-02 20:52 ` [PATCH] scsi: qla2xxx: " Thomas Meyer
                   ` (2 subsequent siblings)
  15 siblings, 1 reply; 37+ messages in thread
From: Thomas Meyer @ 2018-12-02 20:52 UTC (permalink / raw)
  To: dvhart, andy, platform-driver-x86, linux-kernel

NULL check before some freeing functions is not needed.

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

diff -u -p a/drivers/platform/x86/intel_ips.c b/drivers/platform/x86/intel_ips.c
--- a/drivers/platform/x86/intel_ips.c
+++ b/drivers/platform/x86/intel_ips.c
@@ -1300,8 +1300,7 @@ static const struct file_operations ips_
 
 static void ips_debugfs_cleanup(struct ips_driver *ips)
 {
-	if (ips->debug_root)
-		debugfs_remove_recursive(ips->debug_root);
+	debugfs_remove_recursive(ips->debug_root);
 	return;
 }
 

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

* [PATCH] dlm: NULL check before some freeing functions is not needed.
  2018-12-02 20:52 Cocci spatch "ifnullfree" - v4.20-rc4 Thomas Meyer
@ 2018-12-02 20:52   ` Thomas Meyer
  2018-12-02 20:52 ` [PATCH] drm/amdgpu: " Thomas Meyer
                     ` (14 subsequent siblings)
  15 siblings, 0 replies; 37+ messages in thread
From: Thomas Meyer @ 2018-12-02 20:52 UTC (permalink / raw)
  To: ccaulfie, teigland, cluster-devel, linux-kernel

NULL check before some freeing functions is not needed.

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

diff -u -p a/fs/dlm/lockspace.c b/fs/dlm/lockspace.c
--- a/fs/dlm/lockspace.c
+++ b/fs/dlm/lockspace.c
@@ -681,8 +681,7 @@ static int new_lockspace(const char *nam
  out_lkbidr:
 	idr_destroy(&ls->ls_lkbidr);
 	for (i = 0; i < DLM_REMOVE_NAMES_MAX; i++) {
-		if (ls->ls_remove_names[i])
-			kfree(ls->ls_remove_names[i]);
+		kfree(ls->ls_remove_names[i]);
 	}
  out_rsbtbl:
 	vfree(ls->ls_rsbtbl);

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

* [Cluster-devel] [PATCH] dlm: NULL check before some freeing functions is not needed.
@ 2018-12-02 20:52   ` Thomas Meyer
  0 siblings, 0 replies; 37+ messages in thread
From: Thomas Meyer @ 2018-12-02 20:52 UTC (permalink / raw)
  To: cluster-devel.redhat.com

NULL check before some freeing functions is not needed.

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

diff -u -p a/fs/dlm/lockspace.c b/fs/dlm/lockspace.c
--- a/fs/dlm/lockspace.c
+++ b/fs/dlm/lockspace.c
@@ -681,8 +681,7 @@ static int new_lockspace(const char *nam
  out_lkbidr:
 	idr_destroy(&ls->ls_lkbidr);
 	for (i = 0; i < DLM_REMOVE_NAMES_MAX; i++) {
-		if (ls->ls_remove_names[i])
-			kfree(ls->ls_remove_names[i]);
+		kfree(ls->ls_remove_names[i]);
 	}
  out_rsbtbl:
 	vfree(ls->ls_rsbtbl);



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

* [PATCH] KVM: PPC: Book3S HV: NULL check before some freeing functions is not needed.
@ 2018-12-02 20:52   ` Thomas Meyer
  0 siblings, 0 replies; 37+ messages in thread
From: Thomas Meyer @ 2018-12-02 20:52 UTC (permalink / raw)
  To: paulus, benh, mpe, kvm-ppc, linuxppc-dev, linux-kernel

NULL check before some freeing functions is not needed.

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

diff -u -p a/arch/powerpc/kvm/book3s_hv_nested.c b/arch/powerpc/kvm/book3s_hv_nested.c
--- a/arch/powerpc/kvm/book3s_hv_nested.c
+++ b/arch/powerpc/kvm/book3s_hv_nested.c
@@ -1252,8 +1252,7 @@ static long int __kvmhv_nested_page_faul
 	rmapp = &memslot->arch.rmap[gfn - memslot->base_gfn];
 	ret = kvmppc_create_pte(kvm, gp->shadow_pgtable, pte, n_gpa, level,
 				mmu_seq, gp->shadow_lpid, rmapp, &n_rmap);
-	if (n_rmap)
-		kfree(n_rmap);
+	kfree(n_rmap);
 	if (ret = -EAGAIN)
 		ret = RESUME_GUEST;	/* Let the guest try again */
 

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

* Re: [PATCH] KVM: PPC: Book3S HV: NULL check before some freeing functions is not needed.
  2018-12-02 20:52   ` Thomas Meyer
  (?)
@ 2018-12-03  0:06     ` Suraj Jitindar Singh
  -1 siblings, 0 replies; 37+ messages in thread
From: Suraj Jitindar Singh @ 2018-12-03  0:06 UTC (permalink / raw)
  To: Thomas Meyer, paulus, benh, mpe, kvm-ppc, linuxppc-dev, linux-kernel

On Sun, 2018-12-02 at 21:52 +0100, Thomas Meyer wrote:
> NULL check before some freeing functions is not needed.

Technically true, however I think a comment should be added then to
make it clearer to someone reading the code why this is ok.

See below.

Suraj.

> 
> Signed-off-by: Thomas Meyer <thomas@m3y3r.de>
> ---
> 
> diff -u -p a/arch/powerpc/kvm/book3s_hv_nested.c
> b/arch/powerpc/kvm/book3s_hv_nested.c
> --- a/arch/powerpc/kvm/book3s_hv_nested.c
> +++ b/arch/powerpc/kvm/book3s_hv_nested.c
> @@ -1252,8 +1252,7 @@ static long int __kvmhv_nested_page_faul
>  	rmapp = &memslot->arch.rmap[gfn - memslot->base_gfn];
>  	ret = kvmppc_create_pte(kvm, gp->shadow_pgtable, pte, n_gpa,
> level,
>  				mmu_seq, gp->shadow_lpid, rmapp,
> &n_rmap);
> -	if (n_rmap)
> -		kfree(n_rmap);
> +	kfree(n_rmap);

e.g.
/* n_rmap set to NULL in kvmppc_create_pte if reference preserved */

>  	if (ret == -EAGAIN)
>  		ret = RESUME_GUEST;	/* Let the guest try
> again */
>  

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

* Re: [PATCH] KVM: PPC: Book3S HV: NULL check before some freeing functions is not needed.
@ 2018-12-03  0:06     ` Suraj Jitindar Singh
  0 siblings, 0 replies; 37+ messages in thread
From: Suraj Jitindar Singh @ 2018-12-03  0:06 UTC (permalink / raw)
  To: Thomas Meyer, paulus, benh, mpe, kvm-ppc, linuxppc-dev, linux-kernel

On Sun, 2018-12-02 at 21:52 +0100, Thomas Meyer wrote:
> NULL check before some freeing functions is not needed.

Technically true, however I think a comment should be added then to
make it clearer to someone reading the code why this is ok.

See below.

Suraj.

> 
> Signed-off-by: Thomas Meyer <thomas@m3y3r.de>
> ---
> 
> diff -u -p a/arch/powerpc/kvm/book3s_hv_nested.c
> b/arch/powerpc/kvm/book3s_hv_nested.c
> --- a/arch/powerpc/kvm/book3s_hv_nested.c
> +++ b/arch/powerpc/kvm/book3s_hv_nested.c
> @@ -1252,8 +1252,7 @@ static long int __kvmhv_nested_page_faul
>  	rmapp = &memslot->arch.rmap[gfn - memslot->base_gfn];
>  	ret = kvmppc_create_pte(kvm, gp->shadow_pgtable, pte, n_gpa,
> level,
>  				mmu_seq, gp->shadow_lpid, rmapp,
> &n_rmap);
> -	if (n_rmap)
> -		kfree(n_rmap);
> +	kfree(n_rmap);

e.g.
/* n_rmap set to NULL in kvmppc_create_pte if reference preserved */

>  	if (ret == -EAGAIN)
>  		ret = RESUME_GUEST;	/* Let the guest try
> again */
>  

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

* Re: [PATCH] KVM: PPC: Book3S HV: NULL check before some freeing functions is not needed.
@ 2018-12-03  0:06     ` Suraj Jitindar Singh
  0 siblings, 0 replies; 37+ messages in thread
From: Suraj Jitindar Singh @ 2018-12-03  0:06 UTC (permalink / raw)
  To: Thomas Meyer, paulus, benh, mpe, kvm-ppc, linuxppc-dev, linux-kernel

On Sun, 2018-12-02 at 21:52 +0100, Thomas Meyer wrote:
> NULL check before some freeing functions is not needed.

Technically true, however I think a comment should be added then to
make it clearer to someone reading the code why this is ok.

See below.

Suraj.

> 
> Signed-off-by: Thomas Meyer <thomas@m3y3r.de>
> ---
> 
> diff -u -p a/arch/powerpc/kvm/book3s_hv_nested.c
> b/arch/powerpc/kvm/book3s_hv_nested.c
> --- a/arch/powerpc/kvm/book3s_hv_nested.c
> +++ b/arch/powerpc/kvm/book3s_hv_nested.c
> @@ -1252,8 +1252,7 @@ static long int __kvmhv_nested_page_faul
>  	rmapp = &memslot->arch.rmap[gfn - memslot->base_gfn];
>  	ret = kvmppc_create_pte(kvm, gp->shadow_pgtable, pte, n_gpa,
> level,
>  				mmu_seq, gp->shadow_lpid, rmapp,
> &n_rmap);
> -	if (n_rmap)
> -		kfree(n_rmap);
> +	kfree(n_rmap);

e.g.
/* n_rmap set to NULL in kvmppc_create_pte if reference preserved */

>  	if (ret = -EAGAIN)
>  		ret = RESUME_GUEST;	/* Let the guest try
> again */
>  

^ permalink raw reply	[flat|nested] 37+ 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; 37+ messages in thread
From: Rangankar, Manish @ 2018-12-03  5:48 UTC (permalink / raw)
  To: Thomas Meyer, Dept-Eng QLogic Storage Upstream, jejb,
	martin.petersen, linux-scsi, linux-kernel


> -----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] 37+ messages in thread

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


> -----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] 37+ 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; 37+ messages in thread
From: Rangankar, Manish @ 2018-12-03  5:57 UTC (permalink / raw)
  To: Thomas Meyer, Dept-Eng QLogic Storage Upstream, jejb,
	martin.petersen, linux-scsi, linux-kernel


> -----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] 37+ messages in thread

* RE: [PATCH] scsi: qedf: NULL check before some freeing functions is not needed.
@ 2018-12-03  5:57     ` Rangankar, Manish
  0 siblings, 0 replies; 37+ messages in thread
From: Rangankar, Manish @ 2018-12-03  5:57 UTC (permalink / raw)
  To: Thomas Meyer, Dept-Eng QLogic Storage Upstream, jejb,
	martin.petersen, linux-scsi, linux-kernel


> -----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] 37+ 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; 37+ 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] 37+ messages in thread

* Re: [PATCH] scsi: megaraid_sas: NULL check before some freeing functions is not needed.
@ 2018-12-03  6:40     ` Sumit Saxena
  0 siblings, 0 replies; 37+ 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] 37+ messages in thread

* Re: [PATCH] [SCSI] zfcp: NULL check before some freeing functions is not needed.
  2018-12-02 20:52 ` [PATCH] [SCSI] zfcp: " Thomas Meyer
@ 2018-12-03 10:59   ` Steffen Maier
  0 siblings, 0 replies; 37+ messages in thread
From: Steffen Maier @ 2018-12-03 10:59 UTC (permalink / raw)
  To: Thomas Meyer, bblock, schwidefsky, heiko.carstens, linux-s390,
	linux-kernel

Thanks, this was already submitted for v4.12 with
https://www.spinics.net/lists/linux-scsi/msg125190.html
based on
https://www.spinics.net/lists/linux-s390/msg21307.html

Also, previously seen in
https://www.spinics.net/lists/linux-s390/msg22035.html

On 12/02/2018 09:52 PM, Thomas Meyer wrote:
> NULL check before some freeing functions is not needed.
> 
> Signed-off-by: Thomas Meyer <thomas@m3y3r.de>
> ---
> 
> diff -u -p a/drivers/s390/scsi/zfcp_aux.c b/drivers/s390/scsi/zfcp_aux.c
> --- a/drivers/s390/scsi/zfcp_aux.c
> +++ b/drivers/s390/scsi/zfcp_aux.c
> @@ -248,20 +248,13 @@ static int zfcp_allocate_low_mem_buffers
>   
>   static void zfcp_free_low_mem_buffers(struct zfcp_adapter *adapter)
>   {
> -	if (adapter->pool.erp_req)
> -		mempool_destroy(adapter->pool.erp_req);
> -	if (adapter->pool.scsi_req)
> -		mempool_destroy(adapter->pool.scsi_req);
> -	if (adapter->pool.scsi_abort)
> -		mempool_destroy(adapter->pool.scsi_abort);
> -	if (adapter->pool.qtcb_pool)
> -		mempool_destroy(adapter->pool.qtcb_pool);
> -	if (adapter->pool.status_read_req)
> -		mempool_destroy(adapter->pool.status_read_req);
> -	if (adapter->pool.sr_data)
> -		mempool_destroy(adapter->pool.sr_data);
> -	if (adapter->pool.gid_pn)
> -		mempool_destroy(adapter->pool.gid_pn);
> +	mempool_destroy(adapter->pool.erp_req);
> +	mempool_destroy(adapter->pool.scsi_req);
> +	mempool_destroy(adapter->pool.scsi_abort);
> +	mempool_destroy(adapter->pool.qtcb_pool);
> +	mempool_destroy(adapter->pool.status_read_req);
> +	mempool_destroy(adapter->pool.sr_data);
> +	mempool_destroy(adapter->pool.gid_pn);
>   }
>   
>   /**
> 


-- 
Mit freundlichen Gruessen / Kind regards
Steffen Maier

Linux on IBM Z Development

IBM Deutschland Research & Development GmbH
Vorsitzende des Aufsichtsrats: Martina Koederitz
Geschaeftsfuehrung: Dirk Wittkopp
Sitz der Gesellschaft: Boeblingen
Registergericht: Amtsgericht Stuttgart, HRB 243294


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

* Re: [PATCH] drm/amdgpu: NULL check before some freeing functions is not needed.
  2018-12-02 20:52 ` [PATCH] drm/amdgpu: " Thomas Meyer
@ 2018-12-03 11:51   ` Koenig, Christian
  0 siblings, 0 replies; 37+ messages in thread
From: Koenig, Christian @ 2018-12-03 11:51 UTC (permalink / raw)
  To: Thomas Meyer, Deucher, Alexander, Zhou, David(ChunMing),
	airlied, amd-gfx, dri-devel, linux-kernel

Am 02.12.18 um 21:52 schrieb Thomas Meyer:
> NULL check before some freeing functions is not needed.
>
> Signed-off-by: Thomas Meyer <thomas@m3y3r.de>

Reviewed-by: Christian König <christian.koenig@amd.com>

> ---
>
> diff -u -p a/drivers/gpu/drm/amd/amdgpu/amdgpu_acpi.c b/drivers/gpu/drm/amd/amdgpu/amdgpu_acpi.c
> --- a/drivers/gpu/drm/amd/amdgpu/amdgpu_acpi.c
> +++ b/drivers/gpu/drm/amd/amdgpu/amdgpu_acpi.c
> @@ -816,6 +816,5 @@ out:
>   void amdgpu_acpi_fini(struct amdgpu_device *adev)
>   {
>   	unregister_acpi_notifier(&adev->acpi_nb);
> -	if (adev->atif)
> -		kfree(adev->atif);
> +	kfree(adev->atif);
>   }


^ permalink raw reply	[flat|nested] 37+ 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; 37+ 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


> 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] 37+ messages in thread

* Re: [PATCH] platform/x86: intel_ips: NULL check before some freeing functions is not needed.
  2018-12-02 20:52 ` [PATCH] platform/x86: intel_ips: " Thomas Meyer
@ 2018-12-03 19:10   ` Andy Shevchenko
  0 siblings, 0 replies; 37+ messages in thread
From: Andy Shevchenko @ 2018-12-03 19:10 UTC (permalink / raw)
  To: thomas
  Cc: Darren Hart, Andy Shevchenko, Platform Driver, Linux Kernel Mailing List

On Sun, Dec 2, 2018 at 10:55 PM Thomas Meyer <thomas@m3y3r.de> wrote:
>
> NULL check before some freeing functions is not needed.

Pushed to my review and testing queue, thanks!

>
> Signed-off-by: Thomas Meyer <thomas@m3y3r.de>
> ---
>
> diff -u -p a/drivers/platform/x86/intel_ips.c b/drivers/platform/x86/intel_ips.c
> --- a/drivers/platform/x86/intel_ips.c
> +++ b/drivers/platform/x86/intel_ips.c
> @@ -1300,8 +1300,7 @@ static const struct file_operations ips_
>
>  static void ips_debugfs_cleanup(struct ips_driver *ips)
>  {
> -       if (ips->debug_root)
> -               debugfs_remove_recursive(ips->debug_root);
> +       debugfs_remove_recursive(ips->debug_root);
>         return;
>  }
>


-- 
With Best Regards,
Andy Shevchenko

^ permalink raw reply	[flat|nested] 37+ 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; 37+ 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] 37+ 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; 37+ 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] 37+ 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; 37+ 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] 37+ messages in thread

* Re: [PATCH] PM / AVS: SmartReflex: NULL check before some freeing functions is not needed.
  2018-12-02 20:52 ` [PATCH] PM / AVS: SmartReflex: " Thomas Meyer
@ 2018-12-11 18:53   ` Kevin Hilman
  2018-12-17 11:45     ` Rafael J. Wysocki
  0 siblings, 1 reply; 37+ messages in thread
From: Kevin Hilman @ 2018-12-11 18:53 UTC (permalink / raw)
  To: Thomas Meyer, khilman, nm, linux-pm, linux-kernel

Thomas Meyer <thomas@m3y3r.de> writes:

> NULL check before some freeing functions is not needed.
>
> Signed-off-by: Thomas Meyer <thomas@m3y3r.de>

Reviewed-by: Kevin Hilman <khilman@baylibre.com>

> ---
>
> diff -u -p a/drivers/power/avs/smartreflex.c b/drivers/power/avs/smartreflex.c
> --- a/drivers/power/avs/smartreflex.c
> +++ b/drivers/power/avs/smartreflex.c
> @@ -1010,8 +1010,7 @@ static int omap_sr_remove(struct platfor
>  
>  	if (sr_info->autocomp_active)
>  		sr_stop_vddautocomp(sr_info);
> -	if (sr_info->dbg_dir)
> -		debugfs_remove_recursive(sr_info->dbg_dir);
> +	debugfs_remove_recursive(sr_info->dbg_dir);
>  
>  	pm_runtime_disable(&pdev->dev);
>  	list_del(&sr_info->node);

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

* Re: [PATCH] PM / AVS: SmartReflex: NULL check before some freeing functions is not needed.
  2018-12-11 18:53   ` Kevin Hilman
@ 2018-12-17 11:45     ` Rafael J. Wysocki
  0 siblings, 0 replies; 37+ messages in thread
From: Rafael J. Wysocki @ 2018-12-17 11:45 UTC (permalink / raw)
  To: Kevin Hilman, Thomas Meyer; +Cc: khilman, nm, linux-pm, linux-kernel

On Tuesday, December 11, 2018 7:53:05 PM CET Kevin Hilman wrote:
> Thomas Meyer <thomas@m3y3r.de> writes:
> 
> > NULL check before some freeing functions is not needed.
> >
> > Signed-off-by: Thomas Meyer <thomas@m3y3r.de>
> 
> Reviewed-by: Kevin Hilman <khilman@baylibre.com>
> 
> > ---
> >
> > diff -u -p a/drivers/power/avs/smartreflex.c b/drivers/power/avs/smartreflex.c
> > --- a/drivers/power/avs/smartreflex.c
> > +++ b/drivers/power/avs/smartreflex.c
> > @@ -1010,8 +1010,7 @@ static int omap_sr_remove(struct platfor
> >  
> >  	if (sr_info->autocomp_active)
> >  		sr_stop_vddautocomp(sr_info);
> > -	if (sr_info->dbg_dir)
> > -		debugfs_remove_recursive(sr_info->dbg_dir);
> > +	debugfs_remove_recursive(sr_info->dbg_dir);
> >  
> >  	pm_runtime_disable(&pdev->dev);
> >  	list_del(&sr_info->node);
> 

Patch applied, thanks!


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

end of thread, other threads:[~2018-12-17 11:46 UTC | newest]

Thread overview: 37+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2018-12-02 20:52 Cocci spatch "ifnullfree" - v4.20-rc4 Thomas Meyer
2018-12-02 20:52 ` [PATCH] scsi: NULL check before some freeing functions is not needed Thomas Meyer
2018-12-02 20:52 ` [PATCH] drm/amdgpu: " Thomas Meyer
2018-12-03 11:51   ` Koenig, Christian
2018-12-02 20:52 ` [PATCH] scsi: aic7xxx: " Thomas Meyer
2018-12-02 20:52 ` [PATCH] dlm: " Thomas Meyer
2018-12-02 20:52   ` [Cluster-devel] " Thomas Meyer
2018-12-02 20:52 ` [PATCH] [SCSI] zfcp: " Thomas Meyer
2018-12-03 10:59   ` Steffen Maier
2018-12-02 20:52 ` [PATCH] scsi: megaraid_sas: " Thomas Meyer
2018-12-03  6:40   ` Sumit Saxena
2018-12-03  6:40     ` Sumit Saxena
2018-12-08  2:40   ` Martin K. Petersen
2018-12-02 20:52 ` [PATCH] KVM: PPC: Book3S HV: " Thomas Meyer
2018-12-02 20:52   ` Thomas Meyer
2018-12-03  0:06   ` Suraj Jitindar Singh
2018-12-03  0:06     ` Suraj Jitindar Singh
2018-12-03  0:06     ` Suraj Jitindar Singh
2018-12-02 20:52 ` [PATCH] PM / AVS: SmartReflex: " Thomas Meyer
2018-12-11 18:53   ` Kevin Hilman
2018-12-17 11:45     ` Rafael J. Wysocki
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-03  5:48     ` Rangankar, Manish
2018-12-02 20:52 ` [PATCH] scsi: qedf: " Thomas Meyer
2018-12-03  5:57   ` Rangankar, Manish
2018-12-03  5:57     ` Rangankar, Manish
2018-12-08  2:41   ` Martin K. Petersen
2018-12-02 20:52 ` [PATCH] scsi: mpt3sas: " Thomas Meyer
2018-12-02 20:52 ` [PATCH] platform/x86: intel_ips: " Thomas Meyer
2018-12-03 19:10   ` Andy Shevchenko
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: ipr: " Thomas Meyer
2018-12-02 20:52 ` [PATCH] scsi: csiostor: " Thomas Meyer

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.