aboutsummaryrefslogtreecommitdiff
path: root/src/include
diff options
context:
space:
mode:
authorNico Huber <nico.h@gmx.de>2020-10-05 11:08:44 +0200
committerNico Huber <nico.h@gmx.de>2020-10-08 20:31:35 +0000
commit7e6ee912c689d01b36735db7d893a35916f01c96 (patch)
tree19e4a9ae2bd7c557192dec729306000cd5c7ced0 /src/include
parentb5e4e3441841d8d1b7fac1240b7c73d288df66d5 (diff)
device: Clarify use of `config_of()`
We don't want unnecessary die() calls to spread throughout coreboot. Chances are high that we'd add a NON_FATAL_DIE Kconfig eventually. Change-Id: I01c7efdf23672bad3a195b7dc1565a3cc8a087bd Signed-off-by: Nico Huber <nico.h@gmx.de> Reviewed-on: https://review.coreboot.org/c/coreboot/+/46046 Reviewed-by: Angel Pons <th3fanbus@gmail.com> Reviewed-by: Werner Zeh <werner.zeh@siemens.com> Tested-by: build bot (Jenkins) <no-reply@coreboot.org>
Diffstat (limited to 'src/include')
-rw-r--r--src/include/device/device.h6
1 files changed, 6 insertions, 0 deletions
diff --git a/src/include/device/device.h b/src/include/device/device.h
index b53b64a329..031091ab48 100644
--- a/src/include/device/device.h
+++ b/src/include/device/device.h
@@ -339,6 +339,12 @@ DEVTREE_CONST struct device *pcidev_path_on_root_debug(pci_devfn_t devfn, const
void devtree_bug(const char *func, pci_devfn_t devfn);
void __noreturn devtree_die(void);
+/*
+ * Dies if `dev` or `dev->chip_info` are NULL. Returns `dev->chip_info` otherwise.
+ *
+ * Only use if missing `chip_info` is fatal and we can't boot. If it's
+ * not fatal, please handle the NULL case gracefully.
+ */
static inline DEVTREE_CONST void *config_of(const struct device *dev)
{
if (dev && dev->chip_info)