scsi: lpfc: fix "NULL check before some freeing functions is not needed"
Subsystems (2)
PATCH 1/1 scsi: lpfc: fix "NULL check before some freeing functions is not needed"
As dma_pool_destroy and mempool_destroy functions has NULL check. We may not need NULL check before calling them.
Fix below warnings reported by coccicheck ./drivers/scsi/lpfc/lpfc_mem.c:252:2-18: WARNING: NULL check before some freeing functions is not needed. ./drivers/scsi/lpfc/lpfc_mem.c:255:2-18: WARNING: NULL check before some freeing functions is not needed. ./drivers/scsi/lpfc/lpfc_mem.c:258:2-18: WARNING: NULL check before some freeing functions is not needed. ./drivers/scsi/lpfc/lpfc_mem.c:261:2-18: WARNING: NULL check before some freeing functions is not needed. ./drivers/scsi/lpfc/lpfc_mem.c:265:2-18: WARNING: NULL check before some freeing functions is not needed. ./drivers/scsi/lpfc/lpfc_mem.c:269:2-17: WARNING: NULL check before some freeing functions is not needed.
--- drivers/scsi/lpfc/lpfc_mem.c | 21 +++++++++------------ 1 file changed, 9 insertions(+), 12 deletions(-)
drivers/scsi/lpfc/lpfc_mem.c +9 -12
@@ -248,25 +248,22 @@ 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 */
Signature · 1 line
2.7.4
Quoted 17 lines · Hariprasad Kelam
As
dma_pool_destroyandmempool_destroyfunctions has NULL check. We may not need NULL check before calling them.Fix below warnings reported by coccicheck ./drivers/scsi/lpfc/lpfc_mem.c:252:2-18: WARNING: NULL check before some freeing functions is not needed. ./drivers/scsi/lpfc/lpfc_mem.c:255:2-18: WARNING: NULL check before some freeing functions is not needed. ./drivers/scsi/lpfc/lpfc_mem.c:258:2-18: WARNING: NULL check before some freeing functions is not needed. ./drivers/scsi/lpfc/lpfc_mem.c:261:2-18: WARNING: NULL check before some freeing functions is not needed. ./drivers/scsi/lpfc/lpfc_mem.c:265:2-18: WARNING: NULL check before some freeing functions is not needed. ./drivers/scsi/lpfc/lpfc_mem.c:269:2-17: WARNING: NULL check before some freeing functions is not needed.
Quoted 5 lines
Signed-off-by Hariprasad Kelam <[email protected]>--- drivers/scsi/lpfc/lpfc_mem.c | 21 +++++++++------------ 1 file changed, 9 insertions(+), 12 deletions(-)
Thanks
-- james
Martin K. Petersen
AppliedHariprasad,
Quoted 2 lines
As
dma_pool_destroyandmempool_destroyfunctions has NULL check. We may not need NULL check before calling them.
Applied to 5.4/scsi-queue. Thanks!
Signature · 1 line
Martin K. Petersen Oracle Linux Engineering