From e440740ad1c3e2fd8df390d519a8a90670bf7a36 Mon Sep 17 00:00:00 2001 From: Adrien Destugues Date: Mon, 15 Mar 2021 19:22:56 +0100 Subject: [PATCH] sdhci_pci: fix computation of bar index I think this bug was introduced when modifying the code to handle multiple slots. It would result in slots after the first two to use incorrect bar offsets. Should fix one of the problems seen in #16778. --- src/add-ons/kernel/busses/mmc/sdhci_pci.cpp | 5 +---- 1 file changed, 1 insertion(+), 4 deletions(-) diff --git a/src/add-ons/kernel/busses/mmc/sdhci_pci.cpp b/src/add-ons/kernel/busses/mmc/sdhci_pci.cpp index 152956a978..0b8eb660ca 100644 --- a/src/add-ons/kernel/busses/mmc/sdhci_pci.cpp +++ b/src/add-ons/kernel/busses/mmc/sdhci_pci.cpp @@ -35,7 +35,6 @@ #define SDHCI_PCI_DEVICE_MODULE_NAME "busses/mmc/sdhci_pci/driver_v1" #define SDHCI_PCI_MMC_BUS_MODULE_NAME "busses/mmc/sdhci_pci/device/v1" -#define SLOTS_COUNT "device/slots_count" #define SLOT_NUMBER "device/slot" #define BAR_INDEX "device/bar" @@ -781,8 +780,6 @@ register_child_devices(void* cookie) } for (uint8_t slot = 0; slot <= slots_count; slot++) { - - bar = bar + slot; sprintf(prettyName, "SDHC bus %" B_PRIu8, slot); device_attr attrs[] = { // properties of this controller for mmc bus manager @@ -803,7 +800,7 @@ register_child_devices(void* cookie) // private data to identify device { SLOT_NUMBER, B_UINT8_TYPE, { ui8: slot} }, - { BAR_INDEX, B_UINT8_TYPE, { ui8: bar} }, + { BAR_INDEX, B_UINT8_TYPE, { ui8: bar + slot} }, { NULL } }; device_node* node;