[openwrt/openwrt] kernel: bcma: fallback-sprom: check hosttype

LEDE Commits lede-commits at lists.infradead.org
Mon Apr 24 14:11:36 PDT 2023


noltari pushed a commit to openwrt/openwrt.git, branch master:
https://git.openwrt.org/60acbbb1af143779048bfb95252f33b400d309a5

commit 60acbbb1af143779048bfb95252f33b400d309a5
Author: Álvaro Fernández Rojas <noltari at gmail.com>
AuthorDate: Mon Apr 24 20:38:36 2023 +0200

    kernel: bcma: fallback-sprom: check hosttype
    
    host_pci is only defined when hosttype is BCMA_HOSTTYPE_PCI.
    
    Signed-off-by: Álvaro Fernández Rojas <noltari at gmail.com>
---
 target/linux/generic/files/drivers/bcma/fallback-sprom.c | 9 +++++++--
 1 file changed, 7 insertions(+), 2 deletions(-)

diff --git a/target/linux/generic/files/drivers/bcma/fallback-sprom.c b/target/linux/generic/files/drivers/bcma/fallback-sprom.c
index c6c3cde710..ce93560a48 100644
--- a/target/linux/generic/files/drivers/bcma/fallback-sprom.c
+++ b/target/linux/generic/files/drivers/bcma/fallback-sprom.c
@@ -55,9 +55,14 @@ static struct list_head bcma_fbs_list = LIST_HEAD_INIT(bcma_fbs_list);
 
 int bcma_get_fallback_sprom(struct bcma_bus *bus, struct ssb_sprom *out)
 {
-	const u32 pci_bus = bus->host_pci->bus->number;
-	const u32 pci_dev = PCI_SLOT(bus->host_pci->devfn);
 	struct bcma_fbs *pos;
+	u32 pci_bus, pci_dev;
+
+	if (bus->hosttype != BCMA_HOSTTYPE_PCI)
+		return -ENOENT;
+
+	pci_bus = bus->host_pci->bus->number;
+	pci_dev = PCI_SLOT(bus->host_pci->devfn);
 
 	list_for_each_entry(pos, &bcma_fbs_list, list) {
 		if (pos->pci_bus != pci_bus ||




More information about the lede-commits mailing list