[U-Boot] [PATCH] core: ofnode: do not assert if node not valid in ofnode_get_name()
Kever Yang
kever.yang at rock-chips.com
Fri Jul 19 03:23:47 UTC 2019
In some case with LIVE DT, some node always not valid, or not have
a valid name, eg. blk driver add by mmc.
Return fail instead of Assert for this kind of ofnode, and this
help with assert happen from time to time when of_live is enabled
and DEBUG is enabled.
Signed-off-by: Kever Yang <kever.yang at rock-chips.com>
---
drivers/core/ofnode.c | 6 +++++-
1 file changed, 5 insertions(+), 1 deletion(-)
diff --git a/drivers/core/ofnode.c b/drivers/core/ofnode.c
index c72c6e2673..bd338a4c68 100644
--- a/drivers/core/ofnode.c
+++ b/drivers/core/ofnode.c
@@ -212,7 +212,11 @@ ofnode ofnode_get_parent(ofnode node)
const char *ofnode_get_name(ofnode node)
{
- assert(ofnode_valid(node));
+ if (!ofnode_valid(node)) {
+ debug("%s node not valid\n", __func__);
+ return NULL;
+ }
+
if (ofnode_is_np(node))
return strrchr(node.np->full_name, '/') + 1;
--
2.17.1
More information about the U-Boot
mailing list