linux-kernel.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH -next] scsi: qla2xxx: remove unneeded if-null-free check
@ 2021-04-09 12:09 Qiheng Lin
  2021-04-09 14:15 ` Himanshu Madhani
  2021-04-16  2:51 ` Martin K. Petersen
  0 siblings, 2 replies; 3+ messages in thread
From: Qiheng Lin @ 2021-04-09 12:09 UTC (permalink / raw)
  To: jejb, martin.petersen
  Cc: njavali, GR-QLogic-Storage-Upstream, linux-scsi, linux-kernel,
	Qiheng Lin

Eliminate the following coccicheck warning:

drivers/scsi/qla2xxx/qla_os.c:4622:2-7:
 WARNING: NULL check before some freeing functions is not needed.
drivers/scsi/qla2xxx/qla_os.c:4637:3-8:
 WARNING: NULL check before some freeing functions is not needed.

Signed-off-by: Qiheng Lin <linqiheng@huawei.com>
---
 drivers/scsi/qla2xxx/qla_os.c | 6 ++----
 1 file changed, 2 insertions(+), 4 deletions(-)

diff --git a/drivers/scsi/qla2xxx/qla_os.c b/drivers/scsi/qla2xxx/qla_os.c
index 12959e3874cb..d74c32f84ef5 100644
--- a/drivers/scsi/qla2xxx/qla_os.c
+++ b/drivers/scsi/qla2xxx/qla_os.c
@@ -4618,8 +4618,7 @@ qla2x00_free_fw_dump(struct qla_hw_data *ha)
 		dma_free_coherent(&ha->pdev->dev,
 		    EFT_SIZE, ha->eft, ha->eft_dma);
 
-	if (ha->fw_dump)
-		vfree(ha->fw_dump);
+	vfree(ha->fw_dump);
 
 	ha->fce = NULL;
 	ha->fce_dma = 0;
@@ -4633,8 +4632,7 @@ qla2x00_free_fw_dump(struct qla_hw_data *ha)
 	ha->fw_dump_len = 0;
 
 	for (j = 0; j < 2; j++, fwdt++) {
-		if (fwdt->template)
-			vfree(fwdt->template);
+		vfree(fwdt->template);
 		fwdt->template = NULL;
 		fwdt->length = 0;
 	}
-- 
2.31.1


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

* Re: [PATCH -next] scsi: qla2xxx: remove unneeded if-null-free check
  2021-04-09 12:09 [PATCH -next] scsi: qla2xxx: remove unneeded if-null-free check Qiheng Lin
@ 2021-04-09 14:15 ` Himanshu Madhani
  2021-04-16  2:51 ` Martin K. Petersen
  1 sibling, 0 replies; 3+ messages in thread
From: Himanshu Madhani @ 2021-04-09 14:15 UTC (permalink / raw)
  To: Qiheng Lin
  Cc: James E.J. Bottomley, Martin Petersen, Nilesh Javali,
	GR-QLogic-Storage-Upstream, linux-scsi, linux-kernel



> On Apr 9, 2021, at 7:09 AM, Qiheng Lin <linqiheng@huawei.com> wrote:
> 
> Eliminate the following coccicheck warning:
> 
> drivers/scsi/qla2xxx/qla_os.c:4622:2-7:
> WARNING: NULL check before some freeing functions is not needed.
> drivers/scsi/qla2xxx/qla_os.c:4637:3-8:
> WARNING: NULL check before some freeing functions is not needed.
> 
> Signed-off-by: Qiheng Lin <linqiheng@huawei.com>
> ---
> drivers/scsi/qla2xxx/qla_os.c | 6 ++----
> 1 file changed, 2 insertions(+), 4 deletions(-)
> 
> diff --git a/drivers/scsi/qla2xxx/qla_os.c b/drivers/scsi/qla2xxx/qla_os.c
> index 12959e3874cb..d74c32f84ef5 100644
> --- a/drivers/scsi/qla2xxx/qla_os.c
> +++ b/drivers/scsi/qla2xxx/qla_os.c
> @@ -4618,8 +4618,7 @@ qla2x00_free_fw_dump(struct qla_hw_data *ha)
> 		dma_free_coherent(&ha->pdev->dev,
> 		    EFT_SIZE, ha->eft, ha->eft_dma);
> 
> -	if (ha->fw_dump)
> -		vfree(ha->fw_dump);
> +	vfree(ha->fw_dump);
> 
> 	ha->fce = NULL;
> 	ha->fce_dma = 0;
> @@ -4633,8 +4632,7 @@ qla2x00_free_fw_dump(struct qla_hw_data *ha)
> 	ha->fw_dump_len = 0;
> 
> 	for (j = 0; j < 2; j++, fwdt++) {
> -		if (fwdt->template)
> -			vfree(fwdt->template);
> +		vfree(fwdt->template);
> 		fwdt->template = NULL;
> 		fwdt->length = 0;
> 	}
> -- 
> 2.31.1
> 

Looks Good. 

Reviewed-by: Himanshu Madhani <himanshu.madhani@oracle.com>

--
Himanshu Madhani	 Oracle Linux Engineering


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

* Re: [PATCH -next] scsi: qla2xxx: remove unneeded if-null-free check
  2021-04-09 12:09 [PATCH -next] scsi: qla2xxx: remove unneeded if-null-free check Qiheng Lin
  2021-04-09 14:15 ` Himanshu Madhani
@ 2021-04-16  2:51 ` Martin K. Petersen
  1 sibling, 0 replies; 3+ messages in thread
From: Martin K. Petersen @ 2021-04-16  2:51 UTC (permalink / raw)
  To: jejb, Qiheng Lin
  Cc: Martin K . Petersen, linux-kernel, njavali,
	GR-QLogic-Storage-Upstream, linux-scsi

On Fri, 9 Apr 2021 20:09:25 +0800, Qiheng Lin wrote:

> Eliminate the following coccicheck warning:
> 
> drivers/scsi/qla2xxx/qla_os.c:4622:2-7:
>  WARNING: NULL check before some freeing functions is not needed.
> drivers/scsi/qla2xxx/qla_os.c:4637:3-8:
>  WARNING: NULL check before some freeing functions is not needed.

Applied to 5.13/scsi-queue, thanks!

[1/1] scsi: qla2xxx: remove unneeded if-null-free check
      https://git.kernel.org/mkp/scsi/c/efd2617100d9

-- 
Martin K. Petersen	Oracle Linux Engineering

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

end of thread, other threads:[~2021-04-16  2:52 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2021-04-09 12:09 [PATCH -next] scsi: qla2xxx: remove unneeded if-null-free check Qiheng Lin
2021-04-09 14:15 ` Himanshu Madhani
2021-04-16  2:51 ` Martin K. Petersen

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