Skip to contentSkip to conversation

scsi: lpfc: remove useless code in lpfc_sli4_bsg_link_diag_test

PATCH Applied Gustavo A. R. Silva 3 participants 4 messages Aug 22, 2017 – Aug 24, 2017

Subsystems (2)
lore
Share & tools
lore
#0 lore raw

PATCH 1/1 scsi: lpfc: remove useless code in lpfc_sli4_bsg_link_diag_test

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

---
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(-)
drivers/scsi/lpfc/lpfc_bsg.c +3 -6
index a1686c2..fe9e1c0 100644
@@ -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);
Signature · 1 line
2.5.0
#1 lore raw
Quoted 4 lines · 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.

Quoted 10 lines

Addresses-Coverity-ID: 1226935

---
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

-- james

#2 lore raw
In reply to Gustavo A. R. Silva

Gustavo,

Quoted 3 lines

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!

Signature · 1 line
Martin K. Petersen	Oracle Linux Engineering
#3 lore raw

Hi Martin,

Quoted 9 lines · Martin K. Petersen

Gustavo,

Quoted 3 lines

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. :)

Signature · 1 line
Gustavo A. R. Silva