bge: check that the bus is a pci bus before using it as such

This fixes the following panic on powerpc:
  pci_get_vendor failed for pcib1 on bus ofwbus0, error = 2

PR:		238730
Reported by:	Dennis Clarke <dclarke@blastwave.org>
Tested by:	Dennis Clarke <dclarke@blastwave.org>
MFC after:	2 weeks
This commit is contained in:
avg 2019-07-16 08:36:49 +00:00
parent 5023a071b7
commit eecfc22b8e

View File

@ -3276,6 +3276,8 @@ bge_mbox_reorder(struct bge_softc *sc)
bus = device_get_parent(dev);
if (device_get_devclass(dev) != pcib)
break;
if (device_get_devclass(bus) != pci)
break;
for (i = 0; i < nitems(mbox_reorder_lists); i++) {
if (pci_get_vendor(dev) ==
mbox_reorder_lists[i].vendor &&
@ -3287,8 +3289,6 @@ bge_mbox_reorder(struct bge_softc *sc)
return (1);
}
}
if (device_get_devclass(bus) != pci)
break;
}
return (0);
}