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:
parent
c435d3daa7
commit
3e034b6e9a
@ -184,7 +184,7 @@ DEVTREE_CONST struct device *find_dev_path(
|
|||||||
DEVTREE_CONST struct device *child;
|
DEVTREE_CONST struct device *child;
|
||||||
|
|
||||||
if (!parent) {
|
if (!parent) {
|
||||||
assert(0);
|
BUG();
|
||||||
/* Return NULL in case asserts are considered non-fatal. */
|
/* Return NULL in case asserts are considered non-fatal. */
|
||||||
return NULL;
|
return NULL;
|
||||||
}
|
}
|
||||||
@ -282,7 +282,7 @@ DEVTREE_CONST struct device *pcidev_path_behind_pci2pci_bridge(
|
|||||||
pci_devfn_t devfn)
|
pci_devfn_t devfn)
|
||||||
{
|
{
|
||||||
if (!bridge || (bridge->path.type != DEVICE_PATH_PCI)) {
|
if (!bridge || (bridge->path.type != DEVICE_PATH_PCI)) {
|
||||||
assert(0);
|
BUG();
|
||||||
/* Return NULL in case asserts are non-fatal. */
|
/* Return NULL in case asserts are non-fatal. */
|
||||||
return NULL;
|
return NULL;
|
||||||
}
|
}
|
||||||
|
@ -28,7 +28,7 @@ static void program_smi(uint32_t flags, int gevent_num)
|
|||||||
|
|
||||||
if (!is_gpio_event_level_triggered(flags)) {
|
if (!is_gpio_event_level_triggered(flags)) {
|
||||||
printk(BIOS_ERR, "ERROR: %s - Only level trigger allowed for SMI!\n", __func__);
|
printk(BIOS_ERR, "ERROR: %s - Only level trigger allowed for SMI!\n", __func__);
|
||||||
assert(0);
|
BUG();
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -49,6 +49,6 @@ void chipset_handle_reset(uint32_t status)
|
|||||||
{
|
{
|
||||||
printk(BIOS_ERR, "Error: unexpected call to %s(0x%08x). Doing cold reset.\n",
|
printk(BIOS_ERR, "Error: unexpected call to %s(0x%08x). Doing cold reset.\n",
|
||||||
__func__, status);
|
__func__, status);
|
||||||
assert(0);
|
BUG();
|
||||||
do_cold_reset();
|
do_cold_reset();
|
||||||
}
|
}
|
||||||
|
@ -78,7 +78,7 @@ static inline size_t gpio_group_index(const struct pad_community *comm,
|
|||||||
}
|
}
|
||||||
printk(BIOS_ERR, "%s: pad %d is not found in community %s!\n",
|
printk(BIOS_ERR, "%s: pad %d is not found in community %s!\n",
|
||||||
__func__, relative_pad, comm->name);
|
__func__, relative_pad, comm->name);
|
||||||
assert(0);
|
BUG();
|
||||||
|
|
||||||
return i;
|
return i;
|
||||||
}
|
}
|
||||||
|
@ -831,7 +831,7 @@ void pmic_set_vsim2_cali(unsigned int vsim2_mv)
|
|||||||
break;
|
break;
|
||||||
|
|
||||||
default:
|
default:
|
||||||
assert(0);
|
BUG();
|
||||||
return;
|
return;
|
||||||
};
|
};
|
||||||
|
|
||||||
|
@ -187,7 +187,7 @@ static void lpc_wideio_window(uint16_t base, uint16_t size)
|
|||||||
pci_write_config32(dev, LPC_WIDEIO2_GENERIC_PORT, tmp);
|
pci_write_config32(dev, LPC_WIDEIO2_GENERIC_PORT, tmp);
|
||||||
enable_wideio(2, size);
|
enable_wideio(2, size);
|
||||||
} else { /* All WIDEIO locations used*/
|
} else { /* All WIDEIO locations used*/
|
||||||
assert(0);
|
BUG();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
Loading…
x
Reference in New Issue
Block a user