Skip to contentSkip to conversation

scsi: qla2xxx: remove redundant null check on pointer sess

PATCH Superseded Colin King 2 participants 2 messages Feb 13, 2019 – Feb 14, 2019

Subsystems (3)

v1 of 2 Superseded Latest is v2 →

lore
Share & tools
lore

Colin King

author
#0 lore raw

PATCH 1/1 scsi: qla2xxx: remove redundant null check on pointer sess

From: Colin Ian King <[email protected]>

The null check on pointer sess and the subsequent call is redundant as sess is null on all the the paths that lead to the out_term2 label. Hence the null check and the call can be removed.

Detected by CoverityScan, CID#1420663 ("Logically dead code")

---
 drivers/scsi/qla2xxx/qla_target.c | 2 --
 1 file changed, 2 deletions(-)
drivers/scsi/qla2xxx/qla_target.c +0 -2
index 6b8c655d9eb4..9af329a5ed90 100644
@@ -6396,8 +6396,6 @@ static void qlt_tmr_work(struct qla_tgt *tgt,
 	return;
 
 out_term2:
-	if (sess)
-		ha->tgt.tgt_ops->put_sess(sess);
 	spin_unlock_irqrestore(&ha->tgt.sess_lock, flags);
 out_term:
 	qlt_send_term_exchange(ha->base_qpair, NULL, &prm->tm_iocb2, 1, 0);
Signature · 1 line
2.20.1
#1 lore raw
Quoted 18 lines · Colin King

From: Colin Ian King <[email protected]>

The null check on pointer sess and the subsequent call is redundant as sess is null on all the the paths that lead to the out_term2 label. Hence the null check and the call can be removed.

Detected by CoverityScan, CID#1420663 ("Logically dead code")

---
 drivers/scsi/qla2xxx/qla_target.c | 2 --
 1 file changed, 2 deletions(-)
drivers/scsi/qla2xxx/qla_target.c +0 -0
index 6b8c655d9eb4..9af329a5ed90 100644

drivers/scsi/qla2xxx/qla_target.c static void qlt_tmr_work(struct qla_tgt *tgt, · line 6400

Quoted 5 lines
drivers/scsi/qla2xxx/qla_target.c +0 -2
@@ -6396,8 +6396,6 @@ static void qlt_tmr_work(struct qla_tgt *tgt,
 	return;
 
 out_term2:
-	if (sess)
-		ha->tgt.tgt_ops->put_sess(sess);

Several places do:

		sess = NULL;
		goto out_term2;

We could remove the "sess = NULL;" because it's not required now.

drivers/scsi/qla2xxx/qla_target.c static void qlt_tmr_work(struct qla_tgt *tgt, · line 6401

Quoted 3 lines
drivers/scsi/qla2xxx/qla_target.c +0 -0
 	spin_unlock_irqrestore(&ha->tgt.sess_lock, flags);
 out_term:
 	qlt_send_term_exchange(ha->base_qpair, NULL, &prm->tm_iocb2, 1, 0);

regards,
dan carpenter