scsi: lpfc: code cleanups in NVME initiator base

This patch addresses the smatch issues identified by Dan Carpenter
in http://www.spinics.net/lists/linux-scsi/msg105663.html

The issues are:

drivers/scsi/lpfc/lpfc_hbadisc.c:316 lpfc_dev_loss_tmo_handler()
warn: we tested 'vport->load_flag & 2' before and it was 'false'

Action: removed item from test

drivers/scsi/lpfc/lpfc_hbadisc.c:701 lpfc_work_done()
warn: test_bit() takes a bit number

Action: changed definition so bit number

drivers/scsi/lpfc/lpfc_hbadisc.c:2206 lpfc_mbx_cmpl_fcf_scan_read_fcf_rec()
error: uninitialized symbol 'vlan_id'.
drivers/scsi/lpfc/lpfc_hbadisc.c:2582 lpfc_mbx_cmpl_fcf_rr_read_fcf_rec()
error: uninitialized symbol 'vlan_id'.
drivers/scsi/lpfc/lpfc_hbadisc.c:2683 lpfc_mbx_cmpl_read_fcf_rec() error:
uninitialized symbol 'vlan_id'.

Action: initilized value

drivers/scsi/lpfc/lpfc_hbadisc.c:4025 lpfc_register_remote_port()
error: we previously assumed 'rdata' could be null (see line 4023)

Action: refactored check block

drivers/scsi/lpfc/lpfc_hbadisc.c:4613 lpfc_sli4_dequeue_nport_iocbs()
error: double unlock 'irq:'

Action: removed inner irq reference

Signed-off-by: Dick Kennedy <dick.kennedy@broadcom.com>
Signed-off-by: James Smart <james.smart@broadcom.com>
Signed-off-by: Martin K. Petersen <martin.petersen@oracle.com>
This commit is contained in:
James Smart 2017-03-04 09:30:38 -08:00 committed by Martin K. Petersen
parent cd46cdedb3
commit 2ade92ae6d
2 changed files with 10 additions and 9 deletions

View File

@ -105,7 +105,7 @@ struct lpfc_sli2_slim;
#define LPFC_MSIX_VECTORS 2 #define LPFC_MSIX_VECTORS 2
/* lpfc wait event data ready flag */ /* lpfc wait event data ready flag */
#define LPFC_DATA_READY (1<<0) #define LPFC_DATA_READY 0 /* bit 0 */
/* queue dump line buffer size */ /* queue dump line buffer size */
#define LPFC_LBUF_SZ 128 #define LPFC_LBUF_SZ 128

View File

@ -313,8 +313,7 @@ lpfc_dev_loss_tmo_handler(struct lpfc_nodelist *ndlp)
ndlp->nlp_state, ndlp->nlp_rpi); ndlp->nlp_state, ndlp->nlp_rpi);
} }
if (!(vport->load_flag & FC_UNLOADING) && if (!(ndlp->nlp_flag & NLP_DELAY_TMO) &&
!(ndlp->nlp_flag & NLP_DELAY_TMO) &&
!(ndlp->nlp_flag & NLP_NPR_2B_DISC) && !(ndlp->nlp_flag & NLP_NPR_2B_DISC) &&
(ndlp->nlp_state != NLP_STE_UNMAPPED_NODE) && (ndlp->nlp_state != NLP_STE_UNMAPPED_NODE) &&
(ndlp->nlp_state != NLP_STE_REG_LOGIN_ISSUE) && (ndlp->nlp_state != NLP_STE_REG_LOGIN_ISSUE) &&
@ -2175,7 +2174,7 @@ lpfc_mbx_cmpl_fcf_scan_read_fcf_rec(struct lpfc_hba *phba, LPFC_MBOXQ_t *mboxq)
uint32_t boot_flag, addr_mode; uint32_t boot_flag, addr_mode;
uint16_t fcf_index, next_fcf_index; uint16_t fcf_index, next_fcf_index;
struct lpfc_fcf_rec *fcf_rec = NULL; struct lpfc_fcf_rec *fcf_rec = NULL;
uint16_t vlan_id; uint16_t vlan_id = LPFC_FCOE_NULL_VID;
bool select_new_fcf; bool select_new_fcf;
int rc; int rc;
@ -4022,9 +4021,11 @@ lpfc_register_remote_port(struct lpfc_vport *vport, struct lpfc_nodelist *ndlp)
rdata = rport->dd_data; rdata = rport->dd_data;
/* break the link before dropping the ref */ /* break the link before dropping the ref */
ndlp->rport = NULL; ndlp->rport = NULL;
if (rdata && rdata->pnode == ndlp) if (rdata) {
if (rdata->pnode == ndlp)
lpfc_nlp_put(ndlp); lpfc_nlp_put(ndlp);
rdata->pnode = NULL; rdata->pnode = NULL;
}
/* drop reference for earlier registeration */ /* drop reference for earlier registeration */
put_device(&rport->dev); put_device(&rport->dev);
} }
@ -4607,9 +4608,9 @@ lpfc_sli4_dequeue_nport_iocbs(struct lpfc_hba *phba,
pring = qp->pring; pring = qp->pring;
if (!pring) if (!pring)
continue; continue;
spin_lock_irq(&pring->ring_lock); spin_lock(&pring->ring_lock);
__lpfc_dequeue_nport_iocbs(phba, ndlp, pring, dequeue_list); __lpfc_dequeue_nport_iocbs(phba, ndlp, pring, dequeue_list);
spin_unlock_irq(&pring->ring_lock); spin_unlock(&pring->ring_lock);
} }
spin_unlock_irq(&phba->hbalock); spin_unlock_irq(&phba->hbalock);
} }