Change all assert(0) to BUG()

I would like to make assertions evaluate at compile time where possible,
but sometimes people used a literal assert(0) to force an assertion in a
certain code path. We already have BUG() for that so let's just replace
those instances with that.

Signed-off-by: Julius Werner <jwerner@chromium.org>
Change-Id: I674e5f8ec7f5fe8b92b1c7c95d9f9202d422ce32
Reviewed-on: https://review.coreboot.org/c/coreboot/+/44047
Tested-by: build bot (Jenkins) <no-reply@coreboot.org>
Reviewed-by: Furquan Shaikh <furquan@google.com>
Reviewed-by: Aaron Durbin <adurbin@chromium.org>
Reviewed-by: Angel Pons <th3fanbus@gmail.com>
This commit is contained in:
Julius Werner
2020-07-29 17:39:21 -07:00
committed by Patrick Georgi
parent c435d3daa7
commit 3e034b6e9a
6 changed files with 7 additions and 7 deletions

View File

@ -184,7 +184,7 @@ DEVTREE_CONST struct device *find_dev_path(
DEVTREE_CONST struct device *child;
if (!parent) {
assert(0);
BUG();
/* Return NULL in case asserts are considered non-fatal. */
return NULL;
}
@ -282,7 +282,7 @@ DEVTREE_CONST struct device *pcidev_path_behind_pci2pci_bridge(
pci_devfn_t devfn)
{
if (!bridge || (bridge->path.type != DEVICE_PATH_PCI)) {
assert(0);
BUG();
/* Return NULL in case asserts are non-fatal. */
return NULL;
}