All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH] scsi: lpfc: remove useless code in lpfc_sli4_bsg_link_diag_test
@ 2017-08-22 20:53 Gustavo A. R. Silva
  2017-08-23 16:20 ` James Smart
  2017-08-24  2:45 ` Martin K. Petersen
  0 siblings, 2 replies; 4+ messages in thread
From: Gustavo A. R. Silva @ 2017-08-22 20:53 UTC (permalink / raw)
  To: James Smart, Dick Kennedy, James E.J. Bottomley,
	Martin K. Petersen
  Cc: linux-scsi, linux-kernel, Gustavo A. R. Silva

Remove variable assignments. The value stored in local variable _rc_ is
overwritten at line 2448:rc = lpfc_sli4_bsg_set_link_diag_state(phba, 0);
before it can be used.

Addresses-Coverity-ID: 1226935
Signed-off-by: Gustavo A. R. Silva <gustavo@embeddedor.com>
---
This issue was detected by Coverity and it was tested by compilation only.
Notice that this code has been there since 2011.

 drivers/scsi/lpfc/lpfc_bsg.c | 9 +++------
 1 file changed, 3 insertions(+), 6 deletions(-)

diff --git a/drivers/scsi/lpfc/lpfc_bsg.c b/drivers/scsi/lpfc/lpfc_bsg.c
index a1686c2..fe9e1c0 100644
--- a/drivers/scsi/lpfc/lpfc_bsg.c
+++ b/drivers/scsi/lpfc/lpfc_bsg.c
@@ -2384,20 +2384,17 @@ lpfc_sli4_bsg_link_diag_test(struct bsg_job *job)
 		goto job_error;
 
 	pmboxq = mempool_alloc(phba->mbox_mem_pool, GFP_KERNEL);
-	if (!pmboxq) {
-		rc = -ENOMEM;
+	if (!pmboxq)
 		goto link_diag_test_exit;
-	}
 
 	req_len = (sizeof(struct lpfc_mbx_set_link_diag_state) -
 		   sizeof(struct lpfc_sli4_cfg_mhdr));
 	alloc_len = lpfc_sli4_config(phba, pmboxq, LPFC_MBOX_SUBSYSTEM_FCOE,
 				     LPFC_MBOX_OPCODE_FCOE_LINK_DIAG_STATE,
 				     req_len, LPFC_SLI4_MBX_EMBED);
-	if (alloc_len != req_len) {
-		rc = -ENOMEM;
+	if (alloc_len != req_len)
 		goto link_diag_test_exit;
-	}
+
 	run_link_diag_test = &pmboxq->u.mqe.un.link_diag_test;
 	bf_set(lpfc_mbx_run_diag_test_link_num, &run_link_diag_test->u.req,
 	       phba->sli4_hba.lnk_info.lnk_no);
-- 
2.5.0

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

* Re: [PATCH] scsi: lpfc: remove useless code in lpfc_sli4_bsg_link_diag_test
  2017-08-22 20:53 [PATCH] scsi: lpfc: remove useless code in lpfc_sli4_bsg_link_diag_test Gustavo A. R. Silva
@ 2017-08-23 16:20 ` James Smart
  2017-08-24  2:45 ` Martin K. Petersen
  1 sibling, 0 replies; 4+ messages in thread
From: James Smart @ 2017-08-23 16:20 UTC (permalink / raw)
  To: Gustavo A. R. Silva, Dick Kennedy, James E.J. Bottomley,
	Martin K. Petersen
  Cc: linux-scsi, linux-kernel

On 8/22/2017 1:53 PM, Gustavo A. R. Silva wrote:
> Remove variable assignments. The value stored in local variable _rc_ is
> overwritten at line 2448:rc = lpfc_sli4_bsg_set_link_diag_state(phba, 0);
> before it can be used.
>
> Addresses-Coverity-ID: 1226935
> Signed-off-by: Gustavo A. R. Silva <gustavo@embeddedor.com>
> ---
> This issue was detected by Coverity and it was tested by compilation only.
> Notice that this code has been there since 2011.
>
>   drivers/scsi/lpfc/lpfc_bsg.c | 9 +++------
>   1 file changed, 3 insertions(+), 6 deletions(-)
>
>

looks good. Thanks

Signed-off-by: James Smart <james.smart@broadcom.com>

-- james

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

* Re: [PATCH] scsi: lpfc: remove useless code in lpfc_sli4_bsg_link_diag_test
  2017-08-22 20:53 [PATCH] scsi: lpfc: remove useless code in lpfc_sli4_bsg_link_diag_test Gustavo A. R. Silva
  2017-08-23 16:20 ` James Smart
@ 2017-08-24  2:45 ` Martin K. Petersen
  2017-08-24 15:26   ` Gustavo A. R. Silva
  1 sibling, 1 reply; 4+ messages in thread
From: Martin K. Petersen @ 2017-08-24  2:45 UTC (permalink / raw)
  To: Gustavo A. R. Silva
  Cc: James Smart, Dick Kennedy, James E.J. Bottomley,
	Martin K. Petersen, linux-scsi, linux-kernel


Gustavo,

> Remove variable assignments. The value stored in local variable _rc_
> is overwritten at line 2448:rc =
> lpfc_sli4_bsg_set_link_diag_state(phba, 0); before it can be used.

Applied to 4.14/scsi-queue. Thank you!

-- 
Martin K. Petersen	Oracle Linux Engineering

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

* Re: [PATCH] scsi: lpfc: remove useless code in lpfc_sli4_bsg_link_diag_test
  2017-08-24  2:45 ` Martin K. Petersen
@ 2017-08-24 15:26   ` Gustavo A. R. Silva
  0 siblings, 0 replies; 4+ messages in thread
From: Gustavo A. R. Silva @ 2017-08-24 15:26 UTC (permalink / raw)
  To: Martin K. Petersen
  Cc: James Smart, Dick Kennedy, James E.J. Bottomley, linux-scsi,
	linux-kernel

Hi Martin,

On 08/23/2017 09:45 PM, Martin K. Petersen wrote:
>
> Gustavo,
>
>> Remove variable assignments. The value stored in local variable _rc_
>> is overwritten at line 2448:rc =
>> lpfc_sli4_bsg_set_link_diag_state(phba, 0); before it can be used.
>
> Applied to 4.14/scsi-queue. Thank you!
>

Glad to help. :)

-- 
Gustavo A. R. Silva

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

end of thread, other threads:[~2017-08-24 15:26 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2017-08-22 20:53 [PATCH] scsi: lpfc: remove useless code in lpfc_sli4_bsg_link_diag_test Gustavo A. R. Silva
2017-08-23 16:20 ` James Smart
2017-08-24  2:45 ` Martin K. Petersen
2017-08-24 15:26   ` Gustavo A. R. Silva

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.