summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorSimon Glass <sjg@chromium.org>2023-06-01 19:22:30 +0300
committerTom Rini <trini@konsulko.com>2023-07-14 19:54:50 +0300
commit11c341b118a236423a294a7d62f71bf33e20aea3 (patch)
tree2f5935b7941a59074666ee83e9983d169254137b
parent18030d9fa225569cc0ff3e87baca52c6e2558e91 (diff)
downloadu-boot-11c341b118a236423a294a7d62f71bf33e20aea3.tar.xz
gpio: Avoid using an invalid ofnode
Devices do not necessarily have nodes attached to them, since they can be created from platdata. In SPL a devicetree may in fact not exist at all. Check the node before using it. This avoids failure when OF_CHECKS is enabled. Signed-off-by: Simon Glass <sjg@chromium.org> Fixes: 5fc7cf8c8e2 ("gpio: add gpio-hog support") Reviewed-by: Heiko Schocher <hs@denx.de>
-rw-r--r--drivers/gpio/gpio-uclass.c2
1 files changed, 1 insertions, 1 deletions
diff --git a/drivers/gpio/gpio-uclass.c b/drivers/gpio/gpio-uclass.c
index 712119c341..31027f3d99 100644
--- a/drivers/gpio/gpio-uclass.c
+++ b/drivers/gpio/gpio-uclass.c
@@ -1474,7 +1474,7 @@ static int gpio_post_bind(struct udevice *dev)
}
#endif
- if (CONFIG_IS_ENABLED(GPIO_HOG)) {
+ if (CONFIG_IS_ENABLED(GPIO_HOG) && dev_has_ofnode(dev)) {
struct udevice *child;
ofnode node;