kernel: bcma: fallback-sprom: check hosttype
authorÁlvaro Fernández Rojas <noltari@gmail.com>
Mon, 24 Apr 2023 18:38:36 +0000 (20:38 +0200)
committerÁlvaro Fernández Rojas <noltari@gmail.com>
Mon, 24 Apr 2023 19:02:29 +0000 (21:02 +0200)
host_pci is only defined when hosttype is BCMA_HOSTTYPE_PCI.

Signed-off-by: Álvaro Fernández Rojas <noltari@gmail.com>
target/linux/generic/files/drivers/bcma/fallback-sprom.c

index c6c3cde7105a93cab06de7f885c03910be7fdf0d..ce93560a4829b9ea26b9e21ab6d2eb57761ea853 100644 (file)
@@ -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 ||