mempool_destroy() can handle NULL pointer correctly, so there is
no need to check NULL pointer before calling mempool_destroy().

Signed-off-by: Chengguang Xu <cgxu...@gmx.com>
---
 drivers/scsi/qla2xxx/qla_os.c | 12 ++++--------
 1 file changed, 4 insertions(+), 8 deletions(-)

diff --git a/drivers/scsi/qla2xxx/qla_os.c b/drivers/scsi/qla2xxx/qla_os.c
index d3dfd273e217..c750033e52b9 100644
--- a/drivers/scsi/qla2xxx/qla_os.c
+++ b/drivers/scsi/qla2xxx/qla_os.c
@@ -4185,12 +4185,10 @@ qla2x00_mem_alloc(struct qla_hw_data *ha, uint16_t 
req_len, uint16_t rsp_len,
        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),
@@ -4492,8 +4490,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,
@@ -4550,8 +4547,7 @@ qla2x00_mem_free(struct qla_hw_data *ha)
 
        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);
 
-- 
2.17.2

Reply via email to