Alexander Kurz
2017-07-02 20:24:52 UTC
Non-OFDEVICE boards may have OFTREE=y set, e.g. by BOOTM_OFTREE.
Attempts to browse the oftree will crash barebox on those boards.
Signed-off-by: Alexander Kurz <***@blala.de>
---
drivers/gpio/gpiolib.c | 5 ++++-
1 file changed, 4 insertions(+), 1 deletion(-)
diff --git a/drivers/gpio/gpiolib.c b/drivers/gpio/gpiolib.c
index a3e17ad..a1ff965 100644
--- a/drivers/gpio/gpiolib.c
+++ b/drivers/gpio/gpiolib.c
@@ -416,7 +416,10 @@ int gpiochip_add(struct gpio_chip *chip)
for (i = chip->base; i < chip->base + chip->ngpio; i++)
gpio_desc[i].chip = chip;
- return of_gpiochip_scan_hogs(chip);
+ if (IS_ENABLED(CONFIG_OFDEVICE))
+ return of_gpiochip_scan_hogs(chip);
+ else
+ return 0;
}
void gpiochip_remove(struct gpio_chip *chip)
Attempts to browse the oftree will crash barebox on those boards.
Signed-off-by: Alexander Kurz <***@blala.de>
---
drivers/gpio/gpiolib.c | 5 ++++-
1 file changed, 4 insertions(+), 1 deletion(-)
diff --git a/drivers/gpio/gpiolib.c b/drivers/gpio/gpiolib.c
index a3e17ad..a1ff965 100644
--- a/drivers/gpio/gpiolib.c
+++ b/drivers/gpio/gpiolib.c
@@ -416,7 +416,10 @@ int gpiochip_add(struct gpio_chip *chip)
for (i = chip->base; i < chip->base + chip->ngpio; i++)
gpio_desc[i].chip = chip;
- return of_gpiochip_scan_hogs(chip);
+ if (IS_ENABLED(CONFIG_OFDEVICE))
+ return of_gpiochip_scan_hogs(chip);
+ else
+ return 0;
}
void gpiochip_remove(struct gpio_chip *chip)
--
2.1.4
2.1.4