Skip to content
Snippets Groups Projects
Commit 11c341b1 authored by Simon Glass's avatar Simon Glass Committed by Tom Rini
Browse files

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's avatarSimon Glass <sjg@chromium.org>
Fixes: 5fc7cf8c ("gpio: add gpio-hog support")
Reviewed-by: default avatarHeiko Schocher <hs@denx.de>
parent 18030d9f
No related branches found
No related tags found
No related merge requests found
......@@ -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;
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment