All of lore.kernel.org
 help / color / mirror / Atom feed
From: Thomas Meyer <thomas@m3y3r.de>
To: james.smart@broadcom.com, dick.kennedy@broadcom.com,
	jejb@linux.vnet.ibm.com, martin.petersen@oracle.com,
	linux-scsi@vger.kernel.org, linux-kernel@vger.kernel.org
Subject: [PATCH] scsi: lpfc: NULL check before some freeing functions is not needed.
Date: Sun, 02 Dec 2018 21:52:11 +0100	[thread overview]
Message-ID: <1543760930051-7732605-9-diffsplit-thomas@m3y3r.de> (raw)
In-Reply-To: <1543760930050-1499171309-0-diffsplit-thomas@m3y3r.de>

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 */

  parent reply	other threads:[~2018-12-02 21:14 UTC|newest]

Thread overview: 37+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
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 ` Thomas Meyer [this message]
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

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=1543760930051-7732605-9-diffsplit-thomas@m3y3r.de \
    --to=thomas@m3y3r.de \
    --cc=dick.kennedy@broadcom.com \
    --cc=james.smart@broadcom.com \
    --cc=jejb@linux.vnet.ibm.com \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-scsi@vger.kernel.org \
    --cc=martin.petersen@oracle.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
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.