diff options
author | Kever Yang <kever.yang@rock-chips.com> | 2019-07-19 06:23:47 +0300 |
---|---|---|
committer | Kever Yang <kever.yang@rock-chips.com> | 2019-08-19 07:43:26 +0300 |
commit | 8f0a70e8162e350fa32122ff7bee78ce9178b0cf (patch) | |
tree | 16483fac7538dd0f0ccf0ddc4ddb7b9ab59ab02d /drivers | |
parent | 8a681f4c5aa15db51ad0209734859c9fe7c29cfd (diff) | |
download | u-boot-8f0a70e8162e350fa32122ff7bee78ce9178b0cf.tar.xz |
core: ofnode: do not assert if node not valid in ofnode_get_name()
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@rock-chips.com>
Reviewed-by: Simon Glass <sjg@chromium.org>
Diffstat (limited to 'drivers')
-rw-r--r-- | drivers/core/ofnode.c | 6 |
1 files changed, 5 insertions, 1 deletions
diff --git a/drivers/core/ofnode.c b/drivers/core/ofnode.c index 2ac73af934..e74a662d1d 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; |