Skip to content

Commit

Permalink
ahci: fix nvec check
Browse files Browse the repository at this point in the history
commit 17a51f1 ("ahci: only try to use multi-MSI mode if there is more
than 1 port") lead to a case where nvec isn't initialized before it's
used.  Fix this by moving the check into the n_ports conditional.

Reported-and-reviewed-by Colin Ian King <colin.king@canonical.com>
Signed-off-by: Christoph Hellwig <hch@lst.de>
Signed-off-by: Tejun Heo <tj@kernel.org>
  • Loading branch information
Christoph Hellwig authored and Tejun Heo committed Oct 20, 2016
1 parent 17a51f1 commit a478b09
Showing 1 changed file with 7 additions and 7 deletions.
14 changes: 7 additions & 7 deletions drivers/ata/ahci.c
Original file line number Diff line number Diff line change
Expand Up @@ -1436,14 +1436,14 @@ static int ahci_init_msi(struct pci_dev *pdev, unsigned int n_ports,
"ahci: MRSM is on, fallback to single MSI\n");
pci_free_irq_vectors(pdev);
}
}

/*
* -ENOSPC indicated we don't have enough vectors. Don't bother trying
* a single vectors for any other error:
*/
if (nvec < 0 && nvec != -ENOSPC)
return nvec;
/*
* -ENOSPC indicated we don't have enough vectors. Don't bother
* trying a single vectors for any other error:
*/
if (nvec < 0 && nvec != -ENOSPC)
return nvec;
}

/*
* If the host is not capable of supporting per-port vectors, fall
Expand Down

0 comments on commit a478b09

Please sign in to comment.