scsi: lpfc: Fix unused assignment in lpfc_sli4_bsg_link_diag_test
authorDick Kennedy <dick.kennedy@broadcom.com>
Tue, 30 Jun 2020 21:49:48 +0000 (14:49 -0700)
committerMartin K. Petersen <martin.petersen@oracle.com>
Fri, 3 Jul 2020 03:06:33 +0000 (23:06 -0400)
commite5fcb81d40d44d3000e5ff8b6c9d87ea36a26faa
treeb97b677e8590a0d7ed92af84a50b211c3ff63126
parent9f2475fe7406b8ef5f97099c4980021344872d9f
scsi: lpfc: Fix unused assignment in lpfc_sli4_bsg_link_diag_test

Coverity reported the following error:

  Assigned value that is never used may represent unnecessary computation.

The rc variable was initially assigned a value but in several cases, when
an error case is detected, it is reassigned a new value. The initial value
had little use.

In code-reviewing this routine, it could use some cleanup:

 - Setting the initialization value to -ENODEV is a much better choice and
   lessens code in the routine.

 - The wasn't tracking logic errors vs no error and mailbox failure.
   Better to resolve by adding a status to track the mailbox failure
   and merge it with the logic error when the routine returns.

Link: https://lore.kernel.org/r/20200630215001.70793-2-jsmart2021@gmail.com
Signed-off-by: Dick Kennedy <dick.kennedy@broadcom.com>
Signed-off-by: James Smart <jsmart2021@gmail.com>
Signed-off-by: Martin K. Petersen <martin.petersen@oracle.com>
drivers/scsi/lpfc/lpfc_bsg.c