Blob Blame History Raw
From: Colin Ian King <colin.king@canonical.com>
Date: Fri, 15 Feb 2019 09:52:32 +0000
Subject: scsi: qla2xxx: remove redundant null check on pointer sess
Patch-mainline: v5.1-rc1
Git-commit: bb6abdd453e123bebdf949a03df5e846ecb5866b
References: bsc#1123034 bsc#1131304 bsc#1127988 bsc#1136215

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.  Also remove the redundant setting
of sess to NULL as this is not required now.

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

Signed-off-by: Colin Ian King <colin.king@canonical.com>
Acked-by: Himanshu Madhani <hmadhani@marvell.com>
Signed-off-by: Martin K. Petersen <martin.petersen@oracle.com>
Acked-by: Daniel Wagner <dwagner@suse.de>
---
 drivers/scsi/qla2xxx/qla_target.c |    6 +-----
 1 file changed, 1 insertion(+), 5 deletions(-)

--- a/drivers/scsi/qla2xxx/qla_target.c
+++ b/drivers/scsi/qla2xxx/qla_target.c
@@ -6346,7 +6346,7 @@ static void qlt_tmr_work(struct qla_tgt
 	struct atio_from_isp *a = &prm->tm_iocb2;
 	struct scsi_qla_host *vha = tgt->vha;
 	struct qla_hw_data *ha = vha->hw;
-	struct fc_port *sess = NULL;
+	struct fc_port *sess;
 	unsigned long flags;
 	uint8_t *s_id = NULL; /* to hide compiler warnings */
 	int rc;
@@ -6372,7 +6372,6 @@ static void qlt_tmr_work(struct qla_tgt
 			goto out_term2;
 	} else {
 		if (sess->deleted) {
-			sess = NULL;
 			goto out_term2;
 		}
 
@@ -6380,7 +6379,6 @@ static void qlt_tmr_work(struct qla_tgt
 			ql_dbg(ql_dbg_tgt_tmr, vha, 0xf020,
 			    "%s: kref_get fail %8phC\n",
 			     __func__, sess->port_name);
-			sess = NULL;
 			goto out_term2;
 		}
 	}
@@ -6399,8 +6397,6 @@ static void qlt_tmr_work(struct qla_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);