aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/scsi/lpfc/lpfc_sli.c
diff options
context:
space:
mode:
Diffstat (limited to 'drivers/scsi/lpfc/lpfc_sli.c')
-rw-r--r--drivers/scsi/lpfc/lpfc_sli.c18
1 files changed, 9 insertions, 9 deletions
diff --git a/drivers/scsi/lpfc/lpfc_sli.c b/drivers/scsi/lpfc/lpfc_sli.c
index f53206411cd8..fc0d9501aba6 100644
--- a/drivers/scsi/lpfc/lpfc_sli.c
+++ b/drivers/scsi/lpfc/lpfc_sli.c
@@ -648,28 +648,24 @@ lpfc_sli_hbqbuf_fill_hbqs(struct lpfc_hba *phba, uint32_t hbqno, uint32_t count)
648 unsigned long flags; 648 unsigned long flags;
649 struct hbq_dmabuf *hbq_buffer; 649 struct hbq_dmabuf *hbq_buffer;
650 650
651 if (!phba->hbqs[hbqno].hbq_alloc_buffer) { 651 if (!phba->hbqs[hbqno].hbq_alloc_buffer)
652 return 0; 652 return 0;
653 }
654 653
655 start = phba->hbqs[hbqno].buffer_count; 654 start = phba->hbqs[hbqno].buffer_count;
656 end = count + start; 655 end = count + start;
657 if (end > lpfc_hbq_defs[hbqno]->entry_count) { 656 if (end > lpfc_hbq_defs[hbqno]->entry_count)
658 end = lpfc_hbq_defs[hbqno]->entry_count; 657 end = lpfc_hbq_defs[hbqno]->entry_count;
659 }
660 658
661 /* Check whether HBQ is still in use */ 659 /* Check whether HBQ is still in use */
662 spin_lock_irqsave(&phba->hbalock, flags); 660 spin_lock_irqsave(&phba->hbalock, flags);
663 if (!phba->hbq_in_use) { 661 if (!phba->hbq_in_use)
664 spin_unlock_irqrestore(&phba->hbalock, flags); 662 goto out;
665 return 0;
666 }
667 663
668 /* Populate HBQ entries */ 664 /* Populate HBQ entries */
669 for (i = start; i < end; i++) { 665 for (i = start; i < end; i++) {
670 hbq_buffer = (phba->hbqs[hbqno].hbq_alloc_buffer)(phba); 666 hbq_buffer = (phba->hbqs[hbqno].hbq_alloc_buffer)(phba);
671 if (!hbq_buffer) 667 if (!hbq_buffer)
672 return 1; 668 goto err;
673 hbq_buffer->tag = (i | (hbqno << 16)); 669 hbq_buffer->tag = (i | (hbqno << 16));
674 if (lpfc_sli_hbq_to_firmware(phba, hbqno, hbq_buffer)) 670 if (lpfc_sli_hbq_to_firmware(phba, hbqno, hbq_buffer))
675 phba->hbqs[hbqno].buffer_count++; 671 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 (phba->hbqs[hbqno].hbq_free_buffer)(phba, hbq_buffer); 673 (phba->hbqs[hbqno].hbq_free_buffer)(phba, hbq_buffer);
678 } 674 }
679 675
676 out:
680 spin_unlock_irqrestore(&phba->hbalock, flags); 677 spin_unlock_irqrestore(&phba->hbalock, flags);
681 return 0; 678 return 0;
679 err:
680 spin_unlock_irqrestore(&phba->hbalock, flags);
681 return 1;
682} 682}
683 683
684int 684int