Commit eafe1df9 authored by Matthew Wilcox's avatar Matthew Wilcox Committed by James Bottomley

[SCSI] lpfc: Balance locking

Commit 3163f725 introduced locking in
lpfc_sli_hbqbuf_fill_hbqs, but missed unlocking on one exit.
Reported-by: default avatarHarvey Harrison <harvey.harrison@gmail.com>
Signed-off-by: default avatarMatthew Wilcox <willy@linux.intel.com>
Acked-by: default avatarJames Smart <james.smart@emulex.com>
Signed-off-by: default avatarJames Bottomley <James.Bottomley@HansenPartnership.com>
parent 65fecc77
...@@ -648,28 +648,24 @@ lpfc_sli_hbqbuf_fill_hbqs(struct lpfc_hba *phba, uint32_t hbqno, uint32_t count) ...@@ -648,28 +648,24 @@ lpfc_sli_hbqbuf_fill_hbqs(struct lpfc_hba *phba, uint32_t hbqno, uint32_t count)
unsigned long flags; unsigned long flags;
struct hbq_dmabuf *hbq_buffer; struct hbq_dmabuf *hbq_buffer;
if (!phba->hbqs[hbqno].hbq_alloc_buffer) { if (!phba->hbqs[hbqno].hbq_alloc_buffer)
return 0; return 0;
}
start = phba->hbqs[hbqno].buffer_count; start = phba->hbqs[hbqno].buffer_count;
end = count + start; end = count + start;
if (end > lpfc_hbq_defs[hbqno]->entry_count) { if (end > lpfc_hbq_defs[hbqno]->entry_count)
end = lpfc_hbq_defs[hbqno]->entry_count; end = lpfc_hbq_defs[hbqno]->entry_count;
}
/* Check whether HBQ is still in use */ /* Check whether HBQ is still in use */
spin_lock_irqsave(&phba->hbalock, flags); spin_lock_irqsave(&phba->hbalock, flags);
if (!phba->hbq_in_use) { if (!phba->hbq_in_use)
spin_unlock_irqrestore(&phba->hbalock, flags); goto out;
return 0;
}
/* Populate HBQ entries */ /* Populate HBQ entries */
for (i = start; i < end; i++) { for (i = start; i < end; i++) {
hbq_buffer = (phba->hbqs[hbqno].hbq_alloc_buffer)(phba); hbq_buffer = (phba->hbqs[hbqno].hbq_alloc_buffer)(phba);
if (!hbq_buffer) if (!hbq_buffer)
return 1; goto err;
hbq_buffer->tag = (i | (hbqno << 16)); hbq_buffer->tag = (i | (hbqno << 16));
if (lpfc_sli_hbq_to_firmware(phba, hbqno, hbq_buffer)) if (lpfc_sli_hbq_to_firmware(phba, hbqno, hbq_buffer))
phba->hbqs[hbqno].buffer_count++; phba->hbqs[hbqno].buffer_count++;
...@@ -677,8 +673,12 @@ lpfc_sli_hbqbuf_fill_hbqs(struct lpfc_hba *phba, uint32_t hbqno, uint32_t count) ...@@ -677,8 +673,12 @@ lpfc_sli_hbqbuf_fill_hbqs(struct lpfc_hba *phba, uint32_t hbqno, uint32_t count)
(phba->hbqs[hbqno].hbq_free_buffer)(phba, hbq_buffer); (phba->hbqs[hbqno].hbq_free_buffer)(phba, hbq_buffer);
} }
out:
spin_unlock_irqrestore(&phba->hbalock, flags); spin_unlock_irqrestore(&phba->hbalock, flags);
return 0; return 0;
err:
spin_unlock_irqrestore(&phba->hbalock, flags);
return 1;
} }
int int
......
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