Skip to content

Commit 18c05fa

Browse files
Yang Limartinkpetersen
authored andcommitted
scsi: qla2xxx: Remove redundant NULL check
Fix below warnings reported by coccicheck: ./drivers/scsi/qla2xxx/qla_init.c:3371:2-7: WARNING: NULL check before some freeing functions is not needed. ./drivers/scsi/qla2xxx/qla_init.c:7855:5-10: WARNING: NULL check before some freeing functions is not needed. ./drivers/scsi/qla2xxx/qla_init.c:7916:2-7: WARNING: NULL check before some freeing functions is not needed. ./drivers/scsi/qla2xxx/qla_init.c:8113:4-18: WARNING: NULL check before some freeing functions is not needed. ./drivers/scsi/qla2xxx/qla_init.c:8174:2-7: WARNING: NULL check before some freeing functions is not needed. Link: https://lore.kernel.org/r/[email protected] Reported-by: Abaci Robot <[email protected]> Reviewed-by: Himanshu Madhani <[email protected]> Signed-off-by: Yang Li <[email protected]> Signed-off-by: Martin K. Petersen <[email protected]>
1 parent 12e3ef8 commit 18c05fa

File tree

1 file changed

+5
-10
lines changed

1 file changed

+5
-10
lines changed

drivers/scsi/qla2xxx/qla_init.c

Lines changed: 5 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -3375,8 +3375,7 @@ qla2x00_alloc_fw_dump(scsi_qla_host_t *vha)
33753375
"Re-Allocated (%d KB) and save firmware dump.\n",
33763376
dump_size / 1024);
33773377
} else {
3378-
if (ha->fw_dump)
3379-
vfree(ha->fw_dump);
3378+
vfree(ha->fw_dump);
33803379
ha->fw_dump = fw_dump;
33813380

33823381
ha->fw_dump_len = ha->fw_dump_alloc_len =
@@ -7876,8 +7875,7 @@ qla24xx_load_risc_flash(scsi_qla_host_t *vha, uint32_t *srisc_addr,
78767875
templates = (risc_attr & BIT_9) ? 2 : 1;
78777876
ql_dbg(ql_dbg_init, vha, 0x0160, "-> templates = %u\n", templates);
78787877
for (j = 0; j < templates; j++, fwdt++) {
7879-
if (fwdt->template)
7880-
vfree(fwdt->template);
7878+
vfree(fwdt->template);
78817879
fwdt->template = NULL;
78827880
fwdt->length = 0;
78837881

@@ -7937,8 +7935,7 @@ qla24xx_load_risc_flash(scsi_qla_host_t *vha, uint32_t *srisc_addr,
79377935
return QLA_SUCCESS;
79387936

79397937
failed:
7940-
if (fwdt->template)
7941-
vfree(fwdt->template);
7938+
vfree(fwdt->template);
79427939
fwdt->template = NULL;
79437940
fwdt->length = 0;
79447941

@@ -8134,8 +8131,7 @@ qla24xx_load_risc_blob(scsi_qla_host_t *vha, uint32_t *srisc_addr)
81348131
templates = (risc_attr & BIT_9) ? 2 : 1;
81358132
ql_dbg(ql_dbg_init, vha, 0x0170, "-> templates = %u\n", templates);
81368133
for (j = 0; j < templates; j++, fwdt++) {
8137-
if (fwdt->template)
8138-
vfree(fwdt->template);
8134+
vfree(fwdt->template);
81398135
fwdt->template = NULL;
81408136
fwdt->length = 0;
81418137

@@ -8195,8 +8191,7 @@ qla24xx_load_risc_blob(scsi_qla_host_t *vha, uint32_t *srisc_addr)
81958191
return QLA_SUCCESS;
81968192

81978193
failed:
8198-
if (fwdt->template)
8199-
vfree(fwdt->template);
8194+
vfree(fwdt->template);
82008195
fwdt->template = NULL;
82018196
fwdt->length = 0;
82028197

0 commit comments

Comments
 (0)