Skip to content

Commit a478b09

Browse files
Christoph Hellwightejun
authored andcommitted
ahci: fix nvec check
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>
1 parent 17a51f1 commit a478b09

1 file changed

Lines changed: 7 additions & 7 deletions

File tree

drivers/ata/ahci.c

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -1436,14 +1436,14 @@ static int ahci_init_msi(struct pci_dev *pdev, unsigned int n_ports,
14361436
"ahci: MRSM is on, fallback to single MSI\n");
14371437
pci_free_irq_vectors(pdev);
14381438
}
1439-
}
14401439

1441-
/*
1442-
* -ENOSPC indicated we don't have enough vectors. Don't bother trying
1443-
* a single vectors for any other error:
1444-
*/
1445-
if (nvec < 0 && nvec != -ENOSPC)
1446-
return nvec;
1440+
/*
1441+
* -ENOSPC indicated we don't have enough vectors. Don't bother
1442+
* trying a single vectors for any other error:
1443+
*/
1444+
if (nvec < 0 && nvec != -ENOSPC)
1445+
return nvec;
1446+
}
14471447

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

0 commit comments

Comments
 (0)