sconfig: check whether component directory actually exists
[coreboot.git] / util / sconfig / main.c
index c3448f35b585ea55b86d1533b79be788891e5683..dab04db321139e9ee3dff1ca3240733fd3b63e7a 100755 (executable)
@@ -131,6 +131,13 @@ struct device *new_chip(struct device *parent, struct device *bus, char *path) {
 
        struct stat st;
        char *chip_h = malloc(strlen(path)+12);
+       sprintf(chip_h, "src/%s", path);
+       if ((stat(chip_h, &st) == -1) && (errno == ENOENT)) {
+               fprintf(stderr, "ERROR: Chip component %s does not exist.\n",
+                               path);
+               exit(1);
+       }
+
        sprintf(chip_h, "src/%s/chip.h", path);
        if ((stat(chip_h, &st) == -1) && (errno == ENOENT))
                new_chip->chiph_exists = 0;