* [PATCH] of: Fix of_find_node_by_path breakage
@ 2013-01-25 11:33 Alexander Shiyan
2013-01-25 18:25 ` Sascha Hauer
0 siblings, 1 reply; 2+ messages in thread
From: Alexander Shiyan @ 2013-01-25 11:33 UTC (permalink / raw)
To: barebox
This patch fixes breakage of of_find_node_by_path when
node not found in tree. This fault is caused, for example,
when no aliases is present in dtb.
barebox@ConnectCore i.MX51:/ oftree -d /env/mm.dtb
/ {
model = "Freescale i.MX51 CCMX51";
compatible = "fsl,imx51-ccmx51", "fsl,imx51";
chosen {
};
cpus {
cpu@0 {
compatible = "arm,cortex-a8";
};
};
};
barebox@ConnectCore i.MX51:/ oftree -p /env/mm.dtb
unable to handle NULL pointer dereference at address 0x00000000
pc : [<97f1f3f0>] lr : [<97f19438>]
sp : 95eff988 ip : 00000001 fp : 97f43080
r10: 00000000 r9 : 97f4304c r8 : 00000000
r7 : 00000000 r6 : e3510034 r5 : 00000001 r4 : 95f0eb28
r3 : 97f43054 r2 : 00000000 r1 : e1a0000b r0 : 00000000
Flags: nzCv IRQs off FIQs off Mode SVC_32
no stack data available
Signed-off-by: Alexander Shiyan <shc_work@mail.ru>
---
drivers/of/base.c | 4 ++--
1 files changed, 2 insertions(+), 2 deletions(-)
diff --git a/drivers/of/base.c b/drivers/of/base.c
index 7a41618..576841d 100644
--- a/drivers/of/base.c
+++ b/drivers/of/base.c
@@ -487,9 +487,9 @@ struct device_node *of_find_node_by_path(const char *path)
list_for_each_entry(np, &allnodes, list) {
if (np->full_name && (strcmp(np->full_name, path) == 0))
- break;
+ return np;
}
- return np;
+ return NULL;
}
EXPORT_SYMBOL(of_find_node_by_path);
--
1.7.3.4
_______________________________________________
barebox mailing list
barebox@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/barebox
^ permalink raw reply [flat|nested] 2+ messages in thread
* Re: [PATCH] of: Fix of_find_node_by_path breakage
2013-01-25 11:33 [PATCH] of: Fix of_find_node_by_path breakage Alexander Shiyan
@ 2013-01-25 18:25 ` Sascha Hauer
0 siblings, 0 replies; 2+ messages in thread
From: Sascha Hauer @ 2013-01-25 18:25 UTC (permalink / raw)
To: Alexander Shiyan; +Cc: barebox
On Fri, Jan 25, 2013 at 03:33:29PM +0400, Alexander Shiyan wrote:
> This patch fixes breakage of of_find_node_by_path when
> node not found in tree. This fault is caused, for example,
> when no aliases is present in dtb.
>
> barebox@ConnectCore i.MX51:/ oftree -d /env/mm.dtb
> / {
> model = "Freescale i.MX51 CCMX51";
> compatible = "fsl,imx51-ccmx51", "fsl,imx51";
> chosen {
> };
> cpus {
> cpu@0 {
> compatible = "arm,cortex-a8";
> };
> };
> };
> barebox@ConnectCore i.MX51:/ oftree -p /env/mm.dtb
> unable to handle NULL pointer dereference at address 0x00000000
> pc : [<97f1f3f0>] lr : [<97f19438>]
> sp : 95eff988 ip : 00000001 fp : 97f43080
> r10: 00000000 r9 : 97f4304c r8 : 00000000
> r7 : 00000000 r6 : e3510034 r5 : 00000001 r4 : 95f0eb28
> r3 : 97f43054 r2 : 00000000 r1 : e1a0000b r0 : 00000000
> Flags: nzCv IRQs off FIQs off Mode SVC_32
>
> no stack data available
>
> Signed-off-by: Alexander Shiyan <shc_work@mail.ru>
Applied, thanks
Sascha
> ---
> drivers/of/base.c | 4 ++--
> 1 files changed, 2 insertions(+), 2 deletions(-)
>
> diff --git a/drivers/of/base.c b/drivers/of/base.c
> index 7a41618..576841d 100644
> --- a/drivers/of/base.c
> +++ b/drivers/of/base.c
> @@ -487,9 +487,9 @@ struct device_node *of_find_node_by_path(const char *path)
>
> list_for_each_entry(np, &allnodes, list) {
> if (np->full_name && (strcmp(np->full_name, path) == 0))
> - break;
> + return np;
> }
> - return np;
> + return NULL;
> }
> EXPORT_SYMBOL(of_find_node_by_path);
>
> --
> 1.7.3.4
>
>
> _______________________________________________
> barebox mailing list
> barebox@lists.infradead.org
> http://lists.infradead.org/mailman/listinfo/barebox
>
--
Pengutronix e.K. | |
Industrial Linux Solutions | http://www.pengutronix.de/ |
Peiner Str. 6-8, 31137 Hildesheim, Germany | Phone: +49-5121-206917-0 |
Amtsgericht Hildesheim, HRA 2686 | Fax: +49-5121-206917-5555 |
_______________________________________________
barebox mailing list
barebox@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/barebox
^ permalink raw reply [flat|nested] 2+ messages in thread
end of thread, other threads:[~2013-01-25 18:25 UTC | newest]
Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2013-01-25 11:33 [PATCH] of: Fix of_find_node_by_path breakage Alexander Shiyan
2013-01-25 18:25 ` Sascha Hauer
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox