Angel Pons has uploaded this change for review. ( https://review.coreboot.org/c/coreboot/+/30865
Change subject: src/nb/intel/sandybridge/pcie.c: remove assert() ......................................................................
src/nb/intel/sandybridge/pcie.c: remove assert()
Use proper if() statements instead.
Change-Id: If097ae6d387de393e45d820b65d60b17026e1805 Signed-off-by: Angel Pons th3fanbus@gmail.com --- M src/northbridge/intel/sandybridge/pcie.c 1 file changed, 3 insertions(+), 7 deletions(-)
git pull ssh://review.coreboot.org:29418/coreboot refs/changes/65/30865/1
diff --git a/src/northbridge/intel/sandybridge/pcie.c b/src/northbridge/intel/sandybridge/pcie.c index bb88c7a..f942433 100644 --- a/src/northbridge/intel/sandybridge/pcie.c +++ b/src/northbridge/intel/sandybridge/pcie.c @@ -19,7 +19,6 @@ #include <device/pci.h> #include <device/pciexp.h> #include <device/pci_ids.h> -#include <assert.h>
static void pcie_disable(struct device *dev) { @@ -30,12 +29,9 @@ #if IS_ENABLED(CONFIG_HAVE_ACPI_TABLES) static const char *pcie_acpi_name(const struct device *dev) { - assert(dev); - - if (dev->path.type != DEVICE_PATH_PCI) + if (!dev || !dev->bus || dev->path.type != DEVICE_PATH_PCI) return NULL;
- assert(dev->bus); if (dev->bus->secondary == 0) switch (dev->path.pci.devfn) { case PCI_DEVFN(1, 0): @@ -49,8 +45,8 @@ };
struct device *const port = dev->bus->dev; - assert(port); - assert(port->bus); + if (!port || !port->bus) + return NULL;
if (dev->path.pci.devfn == PCI_DEVFN(0, 0) && port->bus->secondary == 0 &&