linux-scsi.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH 15/17] lpfc: Delete unnecessary checks before the function call "mempool_destroy"
@ 2015-12-16 23:12 James Smart
  2015-12-17  8:38 ` Hannes Reinecke
  2015-12-17 22:35 ` Sebastian Herbszt
  0 siblings, 2 replies; 3+ messages in thread
From: James Smart @ 2015-12-16 23:12 UTC (permalink / raw)
  To: linux-scsi


From: Markus Elfring <elfring@users.sourceforge.net>

The mempool_destroy() function tests whether its argument is NULL
and then returns immediately. Thus the test around the calls is not needed.

This issue was detected by using the Coccinelle software.

Signed-off-by: Markus Elfring <elfring@users.sourceforge.net>
Signed-off-by: James Smart <james.smart@avagotech.com>
---
 drivers/scsi/lpfc/lpfc_mem.c | 6 ++----
 1 file changed, 2 insertions(+), 4 deletions(-)

diff --git a/drivers/scsi/lpfc/lpfc_mem.c b/drivers/scsi/lpfc/lpfc_mem.c
index 3fa6533..4fb3581 100644
--- a/drivers/scsi/lpfc/lpfc_mem.c
+++ b/drivers/scsi/lpfc/lpfc_mem.c
@@ -231,15 +231,13 @@ lpfc_mem_free(struct lpfc_hba *phba)
 	if (phba->lpfc_hbq_pool)
 		pci_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 */
 	mempool_destroy(phba->nlp_mem_pool);
 	phba->nlp_mem_pool = NULL;
-	if (phba->sli_rev == LPFC_SLI_REV4 && phba->active_rrq_pool) {
+	if (phba->sli_rev == LPFC_SLI_REV4) {
 		mempool_destroy(phba->active_rrq_pool);
 		phba->active_rrq_pool = NULL;
 	}
-- 
1.7.11.7


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

* Re: [PATCH 15/17] lpfc: Delete unnecessary checks before the function call "mempool_destroy"
  2015-12-16 23:12 [PATCH 15/17] lpfc: Delete unnecessary checks before the function call "mempool_destroy" James Smart
@ 2015-12-17  8:38 ` Hannes Reinecke
  2015-12-17 22:35 ` Sebastian Herbszt
  1 sibling, 0 replies; 3+ messages in thread
From: Hannes Reinecke @ 2015-12-17  8:38 UTC (permalink / raw)
  To: James Smart, linux-scsi

On 12/17/2015 12:12 AM, James Smart wrote:
>
> From: Markus Elfring <elfring@users.sourceforge.net>
>
> The mempool_destroy() function tests whether its argument is NULL
> and then returns immediately. Thus the test around the calls is not needed.
>
> This issue was detected by using the Coccinelle software.
>
> Signed-off-by: Markus Elfring <elfring@users.sourceforge.net>
> Signed-off-by: James Smart <james.smart@avagotech.com>
> ---
>   drivers/scsi/lpfc/lpfc_mem.c | 6 ++----
>   1 file changed, 2 insertions(+), 4 deletions(-)
>
> diff --git a/drivers/scsi/lpfc/lpfc_mem.c b/drivers/scsi/lpfc/lpfc_mem.c
> index 3fa6533..4fb3581 100644
> --- a/drivers/scsi/lpfc/lpfc_mem.c
> +++ b/drivers/scsi/lpfc/lpfc_mem.c
> @@ -231,15 +231,13 @@ lpfc_mem_free(struct lpfc_hba *phba)
>   	if (phba->lpfc_hbq_pool)
>   		pci_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 */
>   	mempool_destroy(phba->nlp_mem_pool);
>   	phba->nlp_mem_pool = NULL;
> -	if (phba->sli_rev == LPFC_SLI_REV4 && phba->active_rrq_pool) {
> +	if (phba->sli_rev == LPFC_SLI_REV4) {
>   		mempool_destroy(phba->active_rrq_pool);
>   		phba->active_rrq_pool = NULL;
>   	}
>
Reviewed-by: Hannes Reinecke <hare@suse.com>

Cheers,

Hannes
-- 
Dr. Hannes Reinecke		               zSeries & Storage
hare@suse.de			               +49 911 74053 688
SUSE LINUX GmbH, Maxfeldstr. 5, 90409 Nürnberg
GF: F. Imendörffer, J. Smithard, J. Guild, D. Upmanyu, G. Norton
HRB 21284 (AG Nürnberg)
--
To unsubscribe from this list: send the line "unsubscribe linux-scsi" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html

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

* Re: [PATCH 15/17] lpfc: Delete unnecessary checks before the function call "mempool_destroy"
  2015-12-16 23:12 [PATCH 15/17] lpfc: Delete unnecessary checks before the function call "mempool_destroy" James Smart
  2015-12-17  8:38 ` Hannes Reinecke
@ 2015-12-17 22:35 ` Sebastian Herbszt
  1 sibling, 0 replies; 3+ messages in thread
From: Sebastian Herbszt @ 2015-12-17 22:35 UTC (permalink / raw)
  To: James Smart; +Cc: linux-scsi, Sebastian Herbszt

James Smart wrote:
> From: Markus Elfring <elfring@users.sourceforge.net>
> 
> The mempool_destroy() function tests whether its argument is NULL
> and then returns immediately. Thus the test around the calls is not needed.
> 
> This issue was detected by using the Coccinelle software.
> 
> Signed-off-by: Markus Elfring <elfring@users.sourceforge.net>
> Signed-off-by: James Smart <james.smart@avagotech.com>

Reviewed-by: Sebastian Herbszt <herbszt@gmx.de>

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

end of thread, other threads:[~2015-12-17 22:35 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2015-12-16 23:12 [PATCH 15/17] lpfc: Delete unnecessary checks before the function call "mempool_destroy" James Smart
2015-12-17  8:38 ` Hannes Reinecke
2015-12-17 22:35 ` Sebastian Herbszt

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).