Skip to contentSkip to conversation

scsi: qla2xxx: remove unnecessary NULL check

PATCH Applied Dan Carpenter 3 participants 4 messages Jan 21, 2021 – Jan 27, 2021

Subsystems (3)
lore
Share & tools
lore
#0 lore raw

PATCH 1/1 scsi: qla2xxx: remove unnecessary NULL check

The list iterator can't be NULL so this check is not required. Removing the check silences a Smatch warning about inconsistent NULL checking.

drivers/scsi/qla2xxx/qla_dfs.c:371 qla_dfs_tgt_counters_show()
error: we previously assumed 'fcport' could be null (see line 372)

---
 drivers/scsi/qla2xxx/qla_dfs.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
drivers/scsi/qla2xxx/qla_dfs.c +1 -1
index ccce0eab844e..85bd0e468d43 100644
@@ -369,7 +369,7 @@ qla_dfs_tgt_counters_show(struct seq_file *s, void *unused)
 	seq_puts(s, "\n");
 
 	list_for_each_entry(fcport, &vha->vp_fcports, list) {
-		if (!fcport || !fcport->rport)
+		if (!fcport->rport)
 			continue;
 
 		seq_printf(s, "Target Num = %7d Link Down Count = %14lld\n",
Signature · 1 line
2.29.2
Acked-by on v1 1/1
#1 lore raw

Hi Dan,
Thanks for a patch.

Quoted 34 lines

-----Original Message-----
From: Dan Carpenter <[email protected]>
Sent: Thursday, January 21, 2021 11:39 AM
To: Nilesh Javali <[email protected]>
Cc: GR-QLogic-Storage-Upstream <GR-QLogic-Storage- [email protected]>; James E.J. Bottomley <[email protected]>; Martin K. Petersen <[email protected]>; [email protected]; [email protected]
Subject: [PATCH] scsi: qla2xxx: remove unnecessary NULL check

The list iterator can't be NULL so this check is not required. Removing the check silences a Smatch warning about inconsistent NULL checking.

drivers/scsi/qla2xxx/qla_dfs.c:371 qla_dfs_tgt_counters_show()
error: we previously assumed 'fcport' could be null (see line 372)

---
 drivers/scsi/qla2xxx/qla_dfs.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
drivers/scsi/qla2xxx/qla_dfs.c +1 -1
index ccce0eab844e..85bd0e468d43 100644
@@ -369,7 +369,7 @@ qla_dfs_tgt_counters_show(struct seq_file *s, void
 *unused)
 	seq_puts(s, "\n");
 
 	list_for_each_entry(fcport, &vha->vp_fcports, list) {
-		if (!fcport || !fcport->rport)
+		if (!fcport->rport)
 			continue;
 
Quoted 1 line

seq_printf(s, "Target Num = %7d Link Down Count = %14lld\n",

Thanks,
~Saurav

Quoted 2 lines

--
2.29.2

#2 lore raw
In reply to Dan Carpenter

Dan,

Quoted 5 lines

The list iterator can't be NULL so this check is not required. Removing the check silences a Smatch warning about inconsistent NULL checking.

drivers/scsi/qla2xxx/qla_dfs.c:371 qla_dfs_tgt_counters_show()
error: we previously assumed 'fcport' could be null (see line 372)

Applied to 5.12/scsi-staging, thanks!

Signature · 1 line
Martin K. Petersen	Oracle Linux Engineering
#3 lore raw
In reply to Dan Carpenter
Quoted 5 lines · Dan Carpenter

The list iterator can't be NULL so this check is not required. Removing the check silences a Smatch warning about inconsistent NULL checking.

drivers/scsi/qla2xxx/qla_dfs.c:371 qla_dfs_tgt_counters_show()
error: we previously assumed 'fcport' could be null (see line 372)

Applied to 5.12/scsi-queue, thanks!

[1/1] scsi: qla2xxx: remove unnecessary NULL check

      https://git.kernel.org/mkp/scsi/c/c750a9c9c59a
Signature · 1 line
Martin K. Petersen	Oracle Linux Engineering