Skip to contentSkip to conversation

scsi: qla2xxx: remove unneeded if-null-free check

PATCH Applied Qiheng Lin 3 participants 3 messages Apr 9, 2021 – Apr 16, 2021

Subsystems (2)
lore
Share & tools
lore

Qiheng Lin

author
#0 lore raw

PATCH 1/1 scsi: qla2xxx: remove unneeded if-null-free check

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.

---
 drivers/scsi/qla2xxx/qla_os.c | 6 ++----
 1 file changed, 2 insertions(+), 4 deletions(-)
drivers/scsi/qla2xxx/qla_os.c +2 -4
index 12959e3874cb..d74c32f84ef5 100644
@@ -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;
 	}
Signature · 1 line
2.31.1
Reviewed-by on v1 1/1
#1 lore raw
Quoted 43 lines · 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.

---
drivers/scsi/qla2xxx/qla_os.c | 6 ++----

1 file changed, 2 insertions(+), 4 deletions(-)
drivers/scsi/qla2xxx/qla_os.c +2 -4
index 12959e3874cb..d74c32f84ef5 100644
@@ -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;
 	}
Signature · 1 line
2.31.1

Looks Good.

--
Himanshu Madhani Oracle Linux Engineering

#2 lore raw
In reply to Qiheng Lin
Quoted 6 lines · 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.

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
Signature · 1 line
Martin K. Petersen	Oracle Linux Engineering