[<prev] [next>] [<thread-prev] [day] [month] [year] [list]
Message-ID: <CAL2rwxp=GUa+Uk9kVy9qoZLJ-PU95Jxb5B+OGKG=qujwhRAACA@mail.gmail.com>
Date: Mon, 3 Dec 2018 12:13:18 +0530
From: Sumit Saxena <sumit.saxena@...adcom.com>
To: wen.yang99@....com.cn
Cc: Kashyap Desai <kashyap.desai@...adcom.com>,
Shivasharan Srikanteshwara
<shivasharan.srikanteshwara@...adcom.com>,
LKML <linux-kernel@...r.kernel.org>, zhong.weidong@....com.cn,
Julia Lawall <julia.lawall@...6.fr>
Subject: Re: [PATCH] scsi: megaraid_sas: NULL check before some freeing
functions is not needed
On Wed, Nov 28, 2018 at 1:36 PM Wen Yang <wen.yang99@....com.cn> wrote:
>
> dma_pool_destroy(NULL) is safe, so removes NULL check before freeing
> the mem. This patch also fix the ifnullfree.cocci warnings.
>
> Signed-off-by: Wen Yang <wen.yang99@....com.cn>
Acked-by: Sumit Saxena <sumit.saxena@...adcom.com>
> CC: Julia Lawall <julia.lawall@...6.fr>
> CC: Kashyap Desai <kashyap.desai@...adcom.com>
> CC: Sumit Saxena <sumit.saxena@...adcom.com>
> CC: Shivasharan S <shivasharan.srikanteshwara@...adcom.com>
> CC: linux-kernel@...r.kernel.org
> ---
> drivers/scsi/megaraid/megaraid_sas_fusion.c | 12 ++++--------
> 1 file changed, 4 insertions(+), 8 deletions(-)
>
> diff --git a/drivers/scsi/megaraid/megaraid_sas_fusion.c b/drivers/scsi/megaraid/megaraid_sas_fusion.c
> index f74b5ea24f0f..aa477f09a7a5 100644
> --- a/drivers/scsi/megaraid/megaraid_sas_fusion.c
> +++ b/drivers/scsi/megaraid/megaraid_sas_fusion.c
> @@ -807,10 +807,8 @@ megasas_free_rdpq_fusion(struct megasas_instance *instance) {
>
> }
>
> - if (fusion->reply_frames_desc_pool)
> - dma_pool_destroy(fusion->reply_frames_desc_pool);
> - if (fusion->reply_frames_desc_pool_align)
> - dma_pool_destroy(fusion->reply_frames_desc_pool_align);
> + dma_pool_destroy(fusion->reply_frames_desc_pool);
> + dma_pool_destroy(fusion->reply_frames_desc_pool_align);
>
> if (fusion->rdpq_virt)
> dma_free_coherent(&instance->pdev->dev,
> @@ -830,8 +828,7 @@ megasas_free_reply_fusion(struct megasas_instance *instance) {
> fusion->reply_frames_desc[0],
> fusion->reply_frames_desc_phys[0]);
>
> - if (fusion->reply_frames_desc_pool)
> - dma_pool_destroy(fusion->reply_frames_desc_pool);
> + dma_pool_destroy(fusion->reply_frames_desc_pool);
>
> }
>
> @@ -1627,8 +1624,7 @@ static inline void megasas_free_ioc_init_cmd(struct megasas_instance *instance)
> fusion->ioc_init_cmd->frame,
> fusion->ioc_init_cmd->frame_phys_addr);
>
> - if (fusion->ioc_init_cmd)
> - kfree(fusion->ioc_init_cmd);
> + kfree(fusion->ioc_init_cmd);
> }
>
> /**
> --
> 2.19.1
>
Powered by blists - more mailing lists