diff mbox series

scsi: qla2xxx: remove unnecessary NULL check

Message ID YAkaaSrhn1mFqyHy@mwanda
State New
Headers show
Series scsi: qla2xxx: remove unnecessary NULL check | expand

Commit Message

Dan Carpenter Jan. 21, 2021, 6:08 a.m. UTC
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)

Signed-off-by: Dan Carpenter <dan.carpenter@oracle.com>
---
 drivers/scsi/qla2xxx/qla_dfs.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

Comments

Martin K. Petersen Jan. 23, 2021, 3:04 a.m. UTC | #1
Dan,

> 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!

-- 
Martin K. Petersen	Oracle Linux Engineering
Martin K. Petersen Jan. 27, 2021, 4:54 a.m. UTC | #2
On Thu, 21 Jan 2021 09:08:41 +0300, Dan Carpenter wrote:

> 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

-- 
Martin K. Petersen	Oracle Linux Engineering
diff mbox series

Patch

diff --git a/drivers/scsi/qla2xxx/qla_dfs.c b/drivers/scsi/qla2xxx/qla_dfs.c
index ccce0eab844e..85bd0e468d43 100644
--- a/drivers/scsi/qla2xxx/qla_dfs.c
+++ b/drivers/scsi/qla2xxx/qla_dfs.c
@@ -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",