* [PATCH][V2] scsi: qla2xxx: remove redundant null check on pointer sess
@ 2019-02-15 9:52 Colin King
2019-02-15 22:38 ` Himanshu Madhani
2019-02-16 3:32 ` Martin K. Petersen
0 siblings, 2 replies; 3+ messages in thread
From: Colin King @ 2019-02-15 9:52 UTC (permalink / raw)
To: qla2xxx-upstream, James E . J . Bottomley, Martin K . Petersen,
linux-scsi
Cc: kernel-janitors, linux-kernel
From: Colin Ian King <colin.king@canonical.com>
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>
---
V2: Remove the redundant settings of sess to NULL, thanks to
Dan Carpenter for spotting this.
---
drivers/scsi/qla2xxx/qla_target.c | 6 +-----
1 file changed, 1 insertion(+), 5 deletions(-)
diff --git a/drivers/scsi/qla2xxx/qla_target.c b/drivers/scsi/qla2xxx/qla_target.c
index 6b8c655d9eb4..33131446b327 100644
--- a/drivers/scsi/qla2xxx/qla_target.c
+++ b/drivers/scsi/qla2xxx/qla_target.c
@@ -6343,7 +6343,7 @@ static void qlt_tmr_work(struct qla_tgt *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;
@@ -6369,7 +6369,6 @@ static void qlt_tmr_work(struct qla_tgt *tgt,
goto out_term2;
} else {
if (sess->deleted) {
- sess = NULL;
goto out_term2;
}
@@ -6377,7 +6376,6 @@ static void qlt_tmr_work(struct qla_tgt *tgt,
ql_dbg(ql_dbg_tgt_tmr, vha, 0xf020,
"%s: kref_get fail %8phC\n",
__func__, sess->port_name);
- sess = NULL;
goto out_term2;
}
}
@@ -6396,8 +6394,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);
--
2.20.1
^ permalink raw reply related [flat|nested] 3+ messages in thread
* Re: [PATCH][V2] scsi: qla2xxx: remove redundant null check on pointer sess
2019-02-15 9:52 [PATCH][V2] scsi: qla2xxx: remove redundant null check on pointer sess Colin King
@ 2019-02-15 22:38 ` Himanshu Madhani
2019-02-16 3:32 ` Martin K. Petersen
1 sibling, 0 replies; 3+ messages in thread
From: Himanshu Madhani @ 2019-02-15 22:38 UTC (permalink / raw)
To: Colin King, qla2xxx-upstream@qlogic.com, James E . J . Bottomley,
Martin K . Petersen, linux-scsi@vger.kernel.org
Cc: kernel-janitors@vger.kernel.org, linux-kernel@vger.kernel.org
Hi Colin,
On 2/15/19, 1:52 AM, "Colin King" <colin.king@canonical.com> wrote:
External Email
From: Colin Ian King <colin.king@canonical.com>
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>
---
V2: Remove the redundant settings of sess to NULL, thanks to
Dan Carpenter for spotting this.
---
drivers/scsi/qla2xxx/qla_target.c | 6 +-----
1 file changed, 1 insertion(+), 5 deletions(-)
diff --git a/drivers/scsi/qla2xxx/qla_target.c b/drivers/scsi/qla2xxx/qla_target.c
index 6b8c655d9eb4..33131446b327 100644
--- a/drivers/scsi/qla2xxx/qla_target.c
+++ b/drivers/scsi/qla2xxx/qla_target.c
@@ -6343,7 +6343,7 @@ static void qlt_tmr_work(struct qla_tgt *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;
@@ -6369,7 +6369,6 @@ static void qlt_tmr_work(struct qla_tgt *tgt,
goto out_term2;
} else {
if (sess->deleted) {
- sess = NULL;
goto out_term2;
}
@@ -6377,7 +6376,6 @@ static void qlt_tmr_work(struct qla_tgt *tgt,
ql_dbg(ql_dbg_tgt_tmr, vha, 0xf020,
"%s: kref_get fail %8phC\n",
__func__, sess->port_name);
- sess = NULL;
goto out_term2;
}
}
@@ -6396,8 +6394,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);
--
2.20.1
Thanks for the Patch. Looks good
Acked-by: Himanshu Madhani <hmadhani@marvell.com>
^ permalink raw reply [flat|nested] 3+ messages in thread
* Re: [PATCH][V2] scsi: qla2xxx: remove redundant null check on pointer sess
2019-02-15 9:52 [PATCH][V2] scsi: qla2xxx: remove redundant null check on pointer sess Colin King
2019-02-15 22:38 ` Himanshu Madhani
@ 2019-02-16 3:32 ` Martin K. Petersen
1 sibling, 0 replies; 3+ messages in thread
From: Martin K. Petersen @ 2019-02-16 3:32 UTC (permalink / raw)
To: Colin King
Cc: qla2xxx-upstream, James E . J . Bottomley, Martin K . Petersen,
linux-scsi, kernel-janitors, linux-kernel
Colin,
> 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.
Applied to 5.1/scsi-queue, thanks!
--
Martin K. Petersen Oracle Linux Engineering
^ permalink raw reply [flat|nested] 3+ messages in thread
end of thread, other threads:[~2019-02-16 3:32 UTC | newest]
Thread overview: 3+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2019-02-15 9:52 [PATCH][V2] scsi: qla2xxx: remove redundant null check on pointer sess Colin King
2019-02-15 22:38 ` Himanshu Madhani
2019-02-16 3:32 ` Martin K. Petersen
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox