diff options
author | Christoph Hellwig <hch@lst.de> | 2016-10-20 11:15:41 -0400 |
---|---|---|
committer | Tejun Heo <tj@kernel.org> | 2016-10-20 13:40:14 -0400 |
commit | a478b097474cd9f2268ab1beaca74ff09e652b9b (patch) | |
tree | cfc4712ffb2d1edfa7b762f0c8272e71297dc27c | |
parent | 17a51f12cfbd2814fd35966a069b242569c53e27 (diff) |
ahci: fix nvec check
commit 17a51f12 ("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>
-rw-r--r-- | drivers/ata/ahci.c | 14 |
1 files changed, 7 insertions, 7 deletions
diff --git a/drivers/ata/ahci.c b/drivers/ata/ahci.c index ed311a040fed..60e42e2ed68f 100644 --- a/drivers/ata/ahci.c +++ b/drivers/ata/ahci.c | |||
@@ -1436,14 +1436,14 @@ static int ahci_init_msi(struct pci_dev *pdev, unsigned int n_ports, | |||
1436 | "ahci: MRSM is on, fallback to single MSI\n"); | 1436 | "ahci: MRSM is on, fallback to single MSI\n"); |
1437 | pci_free_irq_vectors(pdev); | 1437 | pci_free_irq_vectors(pdev); |
1438 | } | 1438 | } |
1439 | } | ||
1440 | 1439 | ||
1441 | /* | 1440 | /* |
1442 | * -ENOSPC indicated we don't have enough vectors. Don't bother trying | 1441 | * -ENOSPC indicated we don't have enough vectors. Don't bother |
1443 | * a single vectors for any other error: | 1442 | * trying a single vectors for any other error: |
1444 | */ | 1443 | */ |
1445 | if (nvec < 0 && nvec != -ENOSPC) | 1444 | if (nvec < 0 && nvec != -ENOSPC) |
1446 | return nvec; | 1445 | return nvec; |
1446 | } | ||
1447 | 1447 | ||
1448 | /* | 1448 | /* |
1449 | * If the host is not capable of supporting per-port vectors, fall | 1449 | * If the host is not capable of supporting per-port vectors, fall |