Commit a629852a authored by James Smart's avatar James Smart Committed by James Bottomley

[SCSI] lpfc 8.3.32: Correct null pointer Error in lpfc_sli.c

This patch corrects the issue caught via Smatch and reported by Dan Carpenter:
http://marc.info/?l=linux-scsi&m=133693516103343

Resolve null pointer check ordering that were odd
Reported-by: default avatarDan Carpenter <dan.carpenter@oracle.com>
Signed-off-by: default avatarAlex Iannicelli <alex.iannicelli@emulex.com>
Signed-off-by: default avatarJames Smart <james.smart@emulex.com>
Signed-off-by: default avatarJames Bottomley <JBottomley@Parallels.com>
parent 4f4c1863
...@@ -15863,24 +15863,18 @@ lpfc_drain_txq(struct lpfc_hba *phba) ...@@ -15863,24 +15863,18 @@ lpfc_drain_txq(struct lpfc_hba *phba)
spin_lock_irqsave(&phba->hbalock, iflags); spin_lock_irqsave(&phba->hbalock, iflags);
piocbq = lpfc_sli_ringtx_get(phba, pring); piocbq = lpfc_sli_ringtx_get(phba, pring);
sglq = __lpfc_sli_get_sglq(phba, piocbq);
if (!sglq) {
__lpfc_sli_ringtx_put(phba, pring, piocbq);
spin_unlock_irqrestore(&phba->hbalock, iflags);
break;
} else {
if (!piocbq) { if (!piocbq) {
/* The txq_cnt out of sync. This should
* never happen
*/
sglq = __lpfc_clear_active_sglq(phba,
sglq->sli4_lxritag);
spin_unlock_irqrestore(&phba->hbalock, iflags); spin_unlock_irqrestore(&phba->hbalock, iflags);
lpfc_printf_log(phba, KERN_ERR, LOG_SLI, lpfc_printf_log(phba, KERN_ERR, LOG_SLI,
"2823 txq empty and txq_cnt is %d\n ", "2823 txq empty and txq_cnt is %d\n ",
pring->txq_cnt); pring->txq_cnt);
break; break;
} }
sglq = __lpfc_sli_get_sglq(phba, piocbq);
if (!sglq) {
__lpfc_sli_ringtx_put(phba, pring, piocbq);
spin_unlock_irqrestore(&phba->hbalock, iflags);
break;
} }
/* The xri and iocb resources secured, /* The xri and iocb resources secured,
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment