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

Eliminate the following coccicheck warning:

drivers/scsi/qla4xxx/ql4_os.c:4175:2-7: WARNING:
 NULL check before some freeing functions is not needed.
drivers/scsi/qla4xxx/ql4_os.c:4196:2-7: WARNING:
 NULL check before some freeing functions is not needed.
drivers/scsi/qla4xxx/ql4_os.c:4215:2-7: WARNING:
 NULL check before some freeing functions is not needed.
drivers/scsi/qla4xxx/ql4_os.c:6400:2-7: WARNING:
 NULL check before some freeing functions is not needed.
drivers/scsi/qla4xxx/ql4_os.c:6402:2-7: WARNING:
 NULL check before some freeing functions is not needed.
drivers/scsi/qla4xxx/ql4_os.c:6555:2-7: WARNING:
 NULL check before some freeing functions is not needed.
drivers/scsi/qla4xxx/ql4_os.c:6557:2-7: WARNING:
 NULL check before some freeing functions is not needed.
drivers/scsi/qla4xxx/ql4_os.c:7838:2-7: WARNING:
 NULL check before some freeing functions is not needed.
drivers/scsi/qla4xxx/ql4_os.c:7840:2-7: WARNING:
 NULL check before some freeing functions is not needed.

Signed-off-by: Qiheng Lin <linqiheng@huawei.com>
---
 drivers/scsi/qla4xxx/ql4_os.c | 27 +++++++++------------------
 1 file changed, 9 insertions(+), 18 deletions(-)

diff --git a/drivers/scsi/qla4xxx/ql4_os.c b/drivers/scsi/qla4xxx/ql4_os.c
index 867730ed21f7..ad3afe30f617 100644
--- a/drivers/scsi/qla4xxx/ql4_os.c
+++ b/drivers/scsi/qla4xxx/ql4_os.c
@@ -4171,8 +4171,7 @@ static void qla4xxx_mem_free(struct scsi_qla_host *ha)
 		dma_free_coherent(&ha->pdev->dev, ha->queues_len, ha->queues,
 				  ha->queues_dma);
 
-	if (ha->fw_dump)
-		vfree(ha->fw_dump);
+	vfree(ha->fw_dump);
 
 	ha->queues_len = 0;
 	ha->queues = NULL;
@@ -4192,8 +4191,7 @@ static void qla4xxx_mem_free(struct scsi_qla_host *ha)
 
 	dma_pool_destroy(ha->chap_dma_pool);
 
-	if (ha->chap_list)
-		vfree(ha->chap_list);
+	vfree(ha->chap_list);
 	ha->chap_list = NULL;
 
 	dma_pool_destroy(ha->fw_ddb_dma_pool);
@@ -4211,8 +4209,7 @@ static void qla4xxx_mem_free(struct scsi_qla_host *ha)
 		iounmap(ha->reg);
 	}
 
-	if (ha->reset_tmplt.buff)
-		vfree(ha->reset_tmplt.buff);
+	vfree(ha->reset_tmplt.buff);
 
 	pci_release_regions(ha->pdev);
 }
@@ -6396,10 +6393,8 @@ static int qla4xxx_is_session_exists(struct scsi_qla_host *ha,
 	}
 
 exit_check:
-	if (fw_tddb)
-		vfree(fw_tddb);
-	if (tmp_tddb)
-		vfree(tmp_tddb);
+	vfree(fw_tddb);
+	vfree(tmp_tddb);
 	return ret;
 }
 
@@ -6551,10 +6546,8 @@ static int qla4xxx_is_flash_ddb_exists(struct scsi_qla_host *ha,
 	}
 
 exit_check:
-	if (fw_tddb)
-		vfree(fw_tddb);
-	if (tmp_tddb)
-		vfree(tmp_tddb);
+	vfree(fw_tddb);
+	vfree(tmp_tddb);
 	return ret;
 }
 
@@ -7834,10 +7827,8 @@ static int qla4xxx_sysfs_ddb_logout(struct iscsi_bus_flash_session *fnode_sess,
 		ret = -ESRCH;
 
 exit_ddb_logout:
-	if (flash_tddb)
-		vfree(flash_tddb);
-	if (tmp_tddb)
-		vfree(tmp_tddb);
+	vfree(flash_tddb);
+	vfree(tmp_tddb);
 	if (fw_ddb_entry)
 		dma_pool_free(ha->fw_ddb_dma_pool, fw_ddb_entry, fw_ddb_dma);
 
-- 
2.31.1


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

* Re: [PATCH -next] scsi: qla4xxx: remove unneeded if-null-free check
  2021-04-09 12:03 [PATCH -next] scsi: qla4xxx: remove unneeded if-null-free check Qiheng Lin
@ 2021-04-16  2:51 ` Martin K. Petersen
  0 siblings, 0 replies; 2+ 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, mrangankar,
	linux-scsi, GR-QLogic-Storage-Upstream

On Fri, 9 Apr 2021 20:03:45 +0800, Qiheng Lin wrote:

> Eliminate the following coccicheck warning:
> 
> drivers/scsi/qla4xxx/ql4_os.c:4175:2-7: WARNING:
>  NULL check before some freeing functions is not needed.
> drivers/scsi/qla4xxx/ql4_os.c:4196:2-7: WARNING:
>  NULL check before some freeing functions is not needed.
> drivers/scsi/qla4xxx/ql4_os.c:4215:2-7: WARNING:
>  NULL check before some freeing functions is not needed.
> drivers/scsi/qla4xxx/ql4_os.c:6400:2-7: WARNING:
>  NULL check before some freeing functions is not needed.
> drivers/scsi/qla4xxx/ql4_os.c:6402:2-7: WARNING:
>  NULL check before some freeing functions is not needed.
> drivers/scsi/qla4xxx/ql4_os.c:6555:2-7: WARNING:
>  NULL check before some freeing functions is not needed.
> drivers/scsi/qla4xxx/ql4_os.c:6557:2-7: WARNING:
>  NULL check before some freeing functions is not needed.
> drivers/scsi/qla4xxx/ql4_os.c:7838:2-7: WARNING:
>  NULL check before some freeing functions is not needed.
> drivers/scsi/qla4xxx/ql4_os.c:7840:2-7: WARNING:
>  NULL check before some freeing functions is not needed.

Applied to 5.13/scsi-queue, thanks!

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

-- 
Martin K. Petersen	Oracle Linux Engineering

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

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

Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2021-04-09 12:03 [PATCH -next] scsi: qla4xxx: remove unneeded if-null-free check Qiheng Lin
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).