@@ -50,7 +50,8 @@
#define PCI_SLOT_INFO_SLOTS(x) ((x >> 4) & 7)
#define PCI_SLOT_INFO_FIRST_BAR_MASK 0x07
-#define MAX_SLOTS 8
+#define MAX_SLOTS 6
+#define MAX_BARS 6
struct sdhci_pci_chip;
struct sdhci_pci_slot;
@@ -1282,7 +1283,7 @@ static struct sdhci_pci_slot *sdhci_pci_probe_slot(
{
struct sdhci_pci_slot *slot;
struct sdhci_host *host;
- int ret, bar = first_bar + slotno;
+ int ret, bar = (first_bar + slotno) % MAX_BARS;
if (!(pci_resource_flags(pdev, bar) & IORESOURCE_MEM)) {
dev_err(&pdev->dev, "BAR %d is not iomem. Aborting.\n", bar);
@@ -1481,7 +1482,7 @@ static int sdhci_pci_probe(struct pci_dev *pdev,
first_bar &= PCI_SLOT_INFO_FIRST_BAR_MASK;
- if (first_bar > 5) {
+ if (first_bar > MAX_BARS - 1) {
dev_err(&pdev->dev, "Invalid first BAR. Aborting.\n");
return -ENODEV;
}