mirror of
https://github.com/fail0verflow/switch-coreboot.git
synced 2025-05-04 01:39:18 -04:00
Fix two NULL pointer dereferences in device code.
Add a nasty warning if one of the cases triggers because that should not happen. We should fix the cases where the warning triggers. Signed-off-by: Carl-Daniel Hailfinger <c-d.hailfinger.devel.2006@gmx.net> Acked-by: Ronald G. Minnich <rminnich@gmail.com> git-svn-id: svn://coreboot.org/repository/coreboot-v3@631 f3766cd6-281f-0410-b1cd-43a5c92072e9
This commit is contained in:
parent
d84ac8a8d1
commit
e7ff09b840
2 changed files with 7 additions and 2 deletions
|
@ -278,8 +278,13 @@ static void read_resources(struct bus *bus)
|
|||
struct device *curdev;
|
||||
|
||||
printk(BIOS_SPEW, "%s: %s(%s) read_resources bus %d link: %d\n",
|
||||
__func__, bus->dev->dtsname, dev_path(bus->dev),
|
||||
__func__,
|
||||
(bus->dev ? bus->dev->dtsname : "No dtsname for NULL device"),
|
||||
(bus->dev ? dev_path(bus->dev) : "No path for NULL device"),
|
||||
bus->secondary, bus->link);
|
||||
if (!bus->dev)
|
||||
printk(BIOS_WARNING, "%s: ERROR: bus->dev is NULL!\n",
|
||||
__func__);
|
||||
|
||||
/* Walk through all devices and find which resources they need. */
|
||||
for (curdev = bus->children; curdev; curdev = curdev->sibling) {
|
||||
|
|
|
@ -1101,7 +1101,7 @@ unsigned int pci_scan_bus(struct bus *bus, unsigned int min_devfn,
|
|||
dev = pci_probe_dev(dev, bus, devfn);
|
||||
printk(BIOS_SPEW,
|
||||
"PCI: pci_scan_bus pci_probe_dev returns dev %p(%s)\n",
|
||||
dev, dev->dtsname);
|
||||
dev, dev ? dev->dtsname : "None (not found)");
|
||||
|
||||
/* If this is not a multi function device, or the device is
|
||||
* not present don't waste time probing another function.
|
||||
|
|
Loading…
Add table
Reference in a new issue