diff mbox series

[1/2] scsi: qla4xxx: remove unnecessary condition check for dma_pool_destroy()

Message ID 20181104135750.19779-1-cgxu519@gmx.com (mailing list archive)
State Accepted
Headers show
Series [1/2] scsi: qla4xxx: remove unnecessary condition check for dma_pool_destroy() | expand

Commit Message

Chengguang Xu Nov. 4, 2018, 1:57 p.m. UTC
dma_pool_destroy() can handle NULL pointer correctly, so there is
no need to check NULL pointer before calling dma_pool_destroy().

Signed-off-by: Chengguang Xu <cgxu519@gmx.com>
---
 drivers/scsi/qla4xxx/ql4_os.c | 6 ++----
 1 file changed, 2 insertions(+), 4 deletions(-)

Comments

Rangankar, Manish Nov. 5, 2018, 5:36 a.m. UTC | #1
> -----Original Message-----
> From: Chengguang Xu <cgxu519@gmx.com>
> Sent: Sunday, November 4, 2018 7:28 PM
> To: jejb@linux.vnet.ibm.com; martin.petersen@oracle.com
> Cc: Dept-Eng QLogic Storage Upstream <QLogic-Storage-
> Upstream@cavium.com>; linux-scsi@vger.kernel.org; Chengguang Xu
> <cgxu519@gmx.com>
> Subject: [PATCH 1/2] scsi: qla4xxx: remove unnecessary condition check for
> dma_pool_destroy()
> 
> External Email
> 
> dma_pool_destroy() can handle NULL pointer correctly, so there is no need
> to check NULL pointer before calling dma_pool_destroy().
> 
> Signed-off-by: Chengguang Xu <cgxu519@gmx.com>
> ---
>  drivers/scsi/qla4xxx/ql4_os.c | 6 ++----
>  1 file changed, 2 insertions(+), 4 deletions(-)
> 
> diff --git a/drivers/scsi/qla4xxx/ql4_os.c b/drivers/scsi/qla4xxx/ql4_os.c
> index 051164f755a4..039950ab1cbc 100644
> --- a/drivers/scsi/qla4xxx/ql4_os.c
> +++ b/drivers/scsi/qla4xxx/ql4_os.c
> @@ -4165,15 +4165,13 @@ static void qla4xxx_mem_free(struct
> scsi_qla_host *ha)
> 
>         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>
Martin K. Petersen Nov. 7, 2018, 2:20 a.m. UTC | #2
Chengguang,

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

Applied to 4.21/scsi-queue, thanks.
diff mbox series

Patch

diff --git a/drivers/scsi/qla4xxx/ql4_os.c b/drivers/scsi/qla4xxx/ql4_os.c
index 051164f755a4..039950ab1cbc 100644
--- a/drivers/scsi/qla4xxx/ql4_os.c
+++ b/drivers/scsi/qla4xxx/ql4_os.c
@@ -4165,15 +4165,13 @@  static void qla4xxx_mem_free(struct scsi_qla_host *ha)
 
 	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)) {