[U-Boot] core: ofnode: do not assert if node not valid in ofnode_get_name()
diff mbox series

Message ID 20190719032347.27561-1-kever.yang@rock-chips.com
State Accepted
Commit 8f0a70e8162e350fa32122ff7bee78ce9178b0cf
Delegated to: Kever Yang
Headers show
Series
  • [U-Boot] core: ofnode: do not assert if node not valid in ofnode_get_name()
Related show

Commit Message

Kever Yang July 19, 2019, 3:23 a.m. UTC
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>
---

 drivers/core/ofnode.c | 6 +++++-
 1 file changed, 5 insertions(+), 1 deletion(-)

Comments

Simon Glass July 24, 2019, 7:48 p.m. UTC | #1
On Thu, 18 Jul 2019 at 20:24, Kever Yang <kever.yang@rock-chips.com> wrote:
>
> 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>
> ---
>
>  drivers/core/ofnode.c | 6 +++++-
>  1 file changed, 5 insertions(+), 1 deletion(-)

Reviewed-by: Simon Glass <sjg@chromium.org>
Kever Yang Aug. 12, 2019, 4:33 a.m. UTC | #2
Hi Simon,


     Who is suppose to apply this patch, it's delegate to Philipp now, 
should I take it?


Thanks,

- Kever

On 2019/7/25 上午3:48, Simon Glass wrote:
> On Thu, 18 Jul 2019 at 20:24, Kever Yang <kever.yang@rock-chips.com> wrote:
>> 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>
>> ---
>>
>>   drivers/core/ofnode.c | 6 +++++-
>>   1 file changed, 5 insertions(+), 1 deletion(-)
> Reviewed-by: Simon Glass <sjg@chromium.org>
>
Simon Glass Aug. 12, 2019, 4:49 p.m. UTC | #3
Hi Kever,

On Sun, 11 Aug 2019 at 22:34, Kever Yang <kever.yang@rock-chips.com> wrote:
>
> Hi Simon,
>
>
>      Who is suppose to apply this patch, it's delegate to Philipp now,
> should I take it?

I will leave that to you two.

Regards,
Simon

>
>
> Thanks,
>
> - Kever
>
> On 2019/7/25 上午3:48, Simon Glass wrote:
> > On Thu, 18 Jul 2019 at 20:24, Kever Yang <kever.yang@rock-chips.com> wrote:
> >> 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>
> >> ---
> >>
> >>   drivers/core/ofnode.c | 6 +++++-
> >>   1 file changed, 5 insertions(+), 1 deletion(-)
> > Reviewed-by: Simon Glass <sjg@chromium.org>
> >
>
>
Kever Yang Aug. 19, 2019, 12:20 p.m. UTC | #4
On 2019/7/25 上午3:48, Simon Glass wrote:
> On Thu, 18 Jul 2019 at 20:24, Kever Yang <kever.yang@rock-chips.com> wrote:
>> 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>
>> ---
>>
>>   drivers/core/ofnode.c | 6 +++++-
>>   1 file changed, 5 insertions(+), 1 deletion(-)
> Reviewed-by: Simon Glass <sjg@chromium.org>

Applied to u-boot-rockchip.

Thank,
- Kever
>

Patch
diff mbox series

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;