aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/ata/ahci.c
diff options
context:
space:
mode:
authorChristoph Hellwig <hch@lst.de>2016-10-20 17:15:41 +0200
committerTejun Heo <tj@kernel.org>2016-10-20 13:40:14 -0400
commita478b097474cd9f2268ab1beaca74ff09e652b9b (patch)
treecfc4712ffb2d1edfa7b762f0c8272e71297dc27c /drivers/ata/ahci.c
parentahci: only try to use multi-MSI mode if there is more than 1 port (diff)
downloadlinux-dev-a478b097474cd9f2268ab1beaca74ff09e652b9b.tar.xz
linux-dev-a478b097474cd9f2268ab1beaca74ff09e652b9b.zip
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>
Diffstat (limited to 'drivers/ata/ahci.c')
-rw-r--r--drivers/ata/ahci.c14
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,
"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