Skip to content

Commit

Permalink
bfa: Do not call pci_enable_msix() after it failed once
Browse files Browse the repository at this point in the history
Function pci_enable_msix() should not be called in case
it threw a negative errno from a previous call.

Signed-off-by: Alexander Gordeev <agordeev@redhat.com>
Acked-by: Anil Gurumurthy <anil.gurumurthy@qlogic.com>
Signed-off-by: Christoph Hellwig <hch@lst.de>
  • Loading branch information
Alexander Gordeev authored and Christoph Hellwig committed Jul 29, 2014
1 parent 1e5df2a commit cd69a09
Showing 1 changed file with 23 additions and 25 deletions.
48 changes: 23 additions & 25 deletions drivers/scsi/bfa/bfad.c
Original file line number Diff line number Diff line change
Expand Up @@ -1235,33 +1235,31 @@ bfad_setup_intr(struct bfad_s *bfad)
(bfa_asic_id_cb(pdev->device) && !msix_disable_cb)) {

error = pci_enable_msix(bfad->pcidev, msix_entries, bfad->nvec);
if (error) {
/* In CT1 & CT2, try to allocate just one vector */
if (bfa_asic_id_ctc(pdev->device)) {
printk(KERN_WARNING "bfa %s: trying one msix "
"vector failed to allocate %d[%d]\n",
bfad->pci_name, bfad->nvec, error);
bfad->nvec = 1;
error = pci_enable_msix(bfad->pcidev,
/* In CT1 & CT2, try to allocate just one vector */
if (error > 0 && bfa_asic_id_ctc(pdev->device)) {
printk(KERN_WARNING "bfa %s: trying one msix "
"vector failed to allocate %d[%d]\n",
bfad->pci_name, bfad->nvec, error);
bfad->nvec = 1;
error = pci_enable_msix(bfad->pcidev,
msix_entries, bfad->nvec);
}
}

/*
* Only error number of vector is available.
* We don't have a mechanism to map multiple
* interrupts into one vector, so even if we
* can try to request less vectors, we don't
* know how to associate interrupt events to
* vectors. Linux doesn't duplicate vectors
* in the MSIX table for this case.
*/
if (error) {
printk(KERN_WARNING "bfad%d: "
"pci_enable_msix failed (%d), "
"use line based.\n",
bfad->inst_no, error);
goto line_based;
}
/*
* Only error number of vector is available.
* We don't have a mechanism to map multiple
* interrupts into one vector, so even if we
* can try to request less vectors, we don't
* know how to associate interrupt events to
* vectors. Linux doesn't duplicate vectors
* in the MSIX table for this case.
*/
if (error) {
printk(KERN_WARNING "bfad%d: "
"pci_enable_msix failed (%d), "
"use line based.\n",
bfad->inst_no, error);
goto line_based;
}

/* Disable INTX in MSI-X mode */
Expand Down

0 comments on commit cd69a09

Please sign in to comment.