From 4d99b270187ac8c297404e811c268bb3470f283e Mon Sep 17 00:00:00 2001 From: Furquan Shaikh Date: Thu, 11 Apr 2019 15:13:25 -0700 Subject: util/sconfig: Throw an error if override tree has no devices If override tree does not have any device, then the chip info structure in it cannot be associated with the correct device and ends up being added as a standalone chip info structure without any device actually using it. This change prevents this condition by throwing an error during compilation. BUG=b:130342895 Change-Id: I7b8bb6b3228030a465976ca32ce8ef63f41365dd Signed-off-by: Furquan Shaikh Reviewed-on: https://review.coreboot.org/c/coreboot/+/32289 Tested-by: build bot (Jenkins) Reviewed-by: Duncan Laurie Reviewed-by: Aaron Durbin --- util/sconfig/main.c | 5 +++++ 1 file changed, 5 insertions(+) (limited to 'util') diff --git a/util/sconfig/main.c b/util/sconfig/main.c index 4ac935e7b1..5382f470fd 100644 --- a/util/sconfig/main.c +++ b/util/sconfig/main.c @@ -1316,6 +1316,11 @@ int main(int argc, char **argv) override_devtree = argv[OVERRIDE_DEVICEFILE_ARG]; parse_devicetree(override_devtree, &override_root_bus); + if (!dev_has_children(&override_root_dev)) { + fprintf(stderr, "ERROR: Override tree needs at least one device!\n"); + exit(1); + } + override_devicetree(&base_root_bus, &override_root_bus); } -- cgit v1.2.3