[PATCH 06/40] gpio: Avoid using an invalid ofnode
Simon Glass
sjg at chromium.org
Thu Jun 1 18:22:30 CEST 2023
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 at chromium.org>
Fixes: 5fc7cf8c8e2 ("gpio: add gpio-hog support")
---
drivers/gpio/gpio-uclass.c | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/drivers/gpio/gpio-uclass.c b/drivers/gpio/gpio-uclass.c
index 712119c3415b..31027f3d9902 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;
--
2.41.0.rc0.172.g3f132b7071-goog
More information about the U-Boot
mailing list