All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH] scsi: qla2xxx: remove redundant null check on pointer sess
@ 2019-02-13 13:53 Colin King
  2019-02-14  5:54   ` Dan Carpenter
  0 siblings, 1 reply; 7+ messages in thread
From: Colin King @ 2019-02-13 13:53 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.

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

Signed-off-by: Colin Ian King <colin.king@canonical.com>
---
 drivers/scsi/qla2xxx/qla_target.c | 2 --
 1 file changed, 2 deletions(-)

diff --git a/drivers/scsi/qla2xxx/qla_target.c b/drivers/scsi/qla2xxx/qla_target.c
index 6b8c655d9eb4..9af329a5ed90 100644
--- a/drivers/scsi/qla2xxx/qla_target.c
+++ b/drivers/scsi/qla2xxx/qla_target.c
@@ -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);
-- 
2.20.1


^ permalink raw reply related	[flat|nested] 7+ messages in thread

* Re: [PATCH] scsi: qla2xxx: remove redundant null check on pointer sess
  2019-02-13 13:53 [PATCH] scsi: qla2xxx: remove redundant null check on pointer sess Colin King
@ 2019-02-14  5:54   ` Dan Carpenter
  0 siblings, 0 replies; 7+ messages in thread
From: Dan Carpenter @ 2019-02-14  5:54 UTC (permalink / raw)
  To: Colin King
  Cc: qla2xxx-upstream, James E . J . Bottomley, Martin K . Petersen,
	linux-scsi, kernel-janitors, linux-kernel

On Wed, Feb 13, 2019 at 01:53:35PM +0000, Colin King wrote:
> 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.
> 
> Detected by CoverityScan, CID#1420663 ("Logically dead code")
> 
> Signed-off-by: Colin Ian King <colin.king@canonical.com>
> ---
>  drivers/scsi/qla2xxx/qla_target.c | 2 --
>  1 file changed, 2 deletions(-)
> 
> diff --git a/drivers/scsi/qla2xxx/qla_target.c b/drivers/scsi/qla2xxx/qla_target.c
> index 6b8c655d9eb4..9af329a5ed90 100644
> --- a/drivers/scsi/qla2xxx/qla_target.c
> +++ b/drivers/scsi/qla2xxx/qla_target.c
> @@ -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.

>  	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

^ permalink raw reply	[flat|nested] 7+ messages in thread

* Re: [PATCH] scsi: qla2xxx: remove redundant null check on pointer sess
@ 2019-02-14  5:54   ` Dan Carpenter
  0 siblings, 0 replies; 7+ messages in thread
From: Dan Carpenter @ 2019-02-14  5:54 UTC (permalink / raw)
  To: Colin King
  Cc: qla2xxx-upstream, James E . J . Bottomley, Martin K . Petersen,
	linux-scsi, kernel-janitors, linux-kernel

On Wed, Feb 13, 2019 at 01:53:35PM +0000, Colin King wrote:
> 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.
> 
> Detected by CoverityScan, CID#1420663 ("Logically dead code")
> 
> Signed-off-by: Colin Ian King <colin.king@canonical.com>
> ---
>  drivers/scsi/qla2xxx/qla_target.c | 2 --
>  1 file changed, 2 deletions(-)
> 
> diff --git a/drivers/scsi/qla2xxx/qla_target.c b/drivers/scsi/qla2xxx/qla_target.c
> index 6b8c655d9eb4..9af329a5ed90 100644
> --- a/drivers/scsi/qla2xxx/qla_target.c
> +++ b/drivers/scsi/qla2xxx/qla_target.c
> @@ -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.

>  	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

^ permalink raw reply	[flat|nested] 7+ messages in thread

* [PATCH] scsi: qla2xxx: remove redundant assignment to pointer host
  2019-02-13 13:53 [PATCH] scsi: qla2xxx: remove redundant null check on pointer sess Colin King
@ 2019-09-05 13:42 ` Colin King
  0 siblings, 0 replies; 7+ messages in thread
From: Colin King @ 2019-09-05 13:42 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 pointer host is being initialized with a value that is never read
and is being re-assigned a little later on. The assignment is
redundant and hence can be removed.

Addresses-Coverity: ("Unused value")
Signed-off-by: Colin Ian King <colin.king@canonical.com>
---
 drivers/scsi/qla2xxx/qla_target.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/drivers/scsi/qla2xxx/qla_target.c b/drivers/scsi/qla2xxx/qla_target.c
index 0ffda6171614..584f45a7be2f 100644
--- a/drivers/scsi/qla2xxx/qla_target.c
+++ b/drivers/scsi/qla2xxx/qla_target.c
@@ -463,7 +463,7 @@ void qlt_response_pkt_all_vps(struct scsi_qla_host *vha,
 
 	case IMMED_NOTIFY_TYPE:
 	{
-		struct scsi_qla_host *host = vha;
+		struct scsi_qla_host *host;
 		struct imm_ntfy_from_isp *entry =
 		    (struct imm_ntfy_from_isp *)pkt;
 
-- 
2.20.1


^ permalink raw reply related	[flat|nested] 7+ messages in thread

* [PATCH] scsi: qla2xxx: remove redundant assignment to pointer host
@ 2019-09-05 13:42 ` Colin King
  0 siblings, 0 replies; 7+ messages in thread
From: Colin King @ 2019-09-05 13:42 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 pointer host is being initialized with a value that is never read
and is being re-assigned a little later on. The assignment is
redundant and hence can be removed.

Addresses-Coverity: ("Unused value")
Signed-off-by: Colin Ian King <colin.king@canonical.com>
---
 drivers/scsi/qla2xxx/qla_target.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/drivers/scsi/qla2xxx/qla_target.c b/drivers/scsi/qla2xxx/qla_target.c
index 0ffda6171614..584f45a7be2f 100644
--- a/drivers/scsi/qla2xxx/qla_target.c
+++ b/drivers/scsi/qla2xxx/qla_target.c
@@ -463,7 +463,7 @@ void qlt_response_pkt_all_vps(struct scsi_qla_host *vha,
 
 	case IMMED_NOTIFY_TYPE:
 	{
-		struct scsi_qla_host *host = vha;
+		struct scsi_qla_host *host;
 		struct imm_ntfy_from_isp *entry  		    (struct imm_ntfy_from_isp *)pkt;
 
-- 
2.20.1

^ permalink raw reply related	[flat|nested] 7+ messages in thread

* Re: [PATCH] scsi: qla2xxx: remove redundant assignment to pointer host
  2019-09-05 13:42 ` Colin King
@ 2019-10-01  2:41   ` Martin K. Petersen
  -1 siblings, 0 replies; 7+ messages in thread
From: Martin K. Petersen @ 2019-10-01  2:41 UTC (permalink / raw)
  To: Colin King
  Cc: qla2xxx-upstream, James E . J . Bottomley, Martin K . Petersen,
	linux-scsi, kernel-janitors, linux-kernel


Colin,

> The pointer host is being initialized with a value that is never read
> and is being re-assigned a little later on. The assignment is
> redundant and hence can be removed.

Applied to 5.5/scsi-queue, thanks!

-- 
Martin K. Petersen	Oracle Linux Engineering

^ permalink raw reply	[flat|nested] 7+ messages in thread

* Re: [PATCH] scsi: qla2xxx: remove redundant assignment to pointer host
@ 2019-10-01  2:41   ` Martin K. Petersen
  0 siblings, 0 replies; 7+ messages in thread
From: Martin K. Petersen @ 2019-10-01  2:41 UTC (permalink / raw)
  To: Colin King
  Cc: qla2xxx-upstream, James E . J . Bottomley, Martin K . Petersen,
	linux-scsi, kernel-janitors, linux-kernel


Colin,

> The pointer host is being initialized with a value that is never read
> and is being re-assigned a little later on. The assignment is
> redundant and hence can be removed.

Applied to 5.5/scsi-queue, thanks!

-- 
Martin K. Petersen	Oracle Linux Engineering

^ permalink raw reply	[flat|nested] 7+ messages in thread

end of thread, other threads:[~2019-10-01  2:41 UTC | newest]

Thread overview: 7+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2019-09-05 13:42 [PATCH] scsi: qla2xxx: remove redundant assignment to pointer host Colin King
2019-09-05 13:42 ` Colin King
2019-10-01  2:41 ` Martin K. Petersen
2019-10-01  2:41   ` Martin K. Petersen
  -- strict thread matches above, loose matches on Subject: below --
2019-02-13 13:53 [PATCH] scsi: qla2xxx: remove redundant null check on pointer sess Colin King
2019-02-14  5:54 ` Dan Carpenter
2019-02-14  5:54   ` Dan Carpenter

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.