* [PATCH] of: make sure of_alias is initialized before accessing it @ 2014-08-27 14:09 Laurentiu Tudor [not found] ` <53FDE6A3.3080303-KZfg59tc24xl57MIdRCFDg@public.gmane.org> 0 siblings, 1 reply; 3+ messages in thread From: Laurentiu Tudor @ 2014-08-27 14:09 UTC (permalink / raw) To: devicetree, linux-kernel, linuxppc-dev; +Cc: Laurentiu Tudor, Grant Likely Simply swap of_alias and of_chosen initialization so that of_alias ends up read first. This must be done because it is accessed couple of lines below when trying to initialize the of_stdout using the alias based legacy method. [Fixes a752ee5 - tty: Update hypervisor tty drivers to use core stdout parsing code] Signed-off-by: Laurentiu Tudor <Laurentiu.Tudor@freescale.com> Cc: Grant Likely <grant.likely@linaro.org> --- drivers/of/base.c | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/drivers/of/base.c b/drivers/of/base.c index d8574ad..52f8506 100644 --- a/drivers/of/base.c +++ b/drivers/of/base.c @@ -1847,6 +1847,10 @@ void of_alias_scan(void * (*dt_alloc)(u64 size, u64 align)) { struct property *pp; + of_aliases = of_find_node_by_path("/aliases"); + if (!of_aliases) + return; + of_chosen = of_find_node_by_path("/chosen"); if (of_chosen == NULL) of_chosen = of_find_node_by_path("/chosen@0"); @@ -1862,10 +1866,6 @@ void of_alias_scan(void * (*dt_alloc)(u64 size, u64 align)) of_stdout = of_find_node_by_path(name); } - of_aliases = of_find_node_by_path("/aliases"); - if (!of_aliases) - return; - for_each_property_of_node(of_aliases, pp) { const char *start = pp->name; const char *end = start + strlen(start); -- 1.8.3.1 ^ permalink raw reply related [flat|nested] 3+ messages in thread
[parent not found: <53FDE6A3.3080303-KZfg59tc24xl57MIdRCFDg@public.gmane.org>]
* Re: [PATCH] of: make sure of_alias is initialized before accessing it [not found] ` <53FDE6A3.3080303-KZfg59tc24xl57MIdRCFDg@public.gmane.org> @ 2014-09-08 13:29 ` Grant Likely [not found] ` <20140908132956.646FEC40AE5-WNowdnHR2B42iJbIjFUEsiwD8/FfD2ys@public.gmane.org> 0 siblings, 1 reply; 3+ messages in thread From: Grant Likely @ 2014-09-08 13:29 UTC (permalink / raw) To: Laurentiu Tudor, devicetree-u79uwXL29TY76Z2rM5mHXA, linux-kernel-u79uwXL29TY76Z2rM5mHXA, linuxppc-dev Cc: Laurentiu Tudor On Wed, 27 Aug 2014 17:09:39 +0300, Laurentiu Tudor <b10716-KZfg59tc24xl57MIdRCFDg@public.gmane.org> wrote: > Simply swap of_alias and of_chosen initialization so > that of_alias ends up read first. This must be done > because it is accessed couple of lines below when > trying to initialize the of_stdout using the alias > based legacy method. > > [Fixes a752ee5 - tty: Update hypervisor tty drivers to > use core stdout parsing code] > > Signed-off-by: Laurentiu Tudor <Laurentiu.Tudor-KZfg59tc24xl57MIdRCFDg@public.gmane.org> > Cc: Grant Likely <grant.likely-QSEj5FYQhm4dnm+yROfE0A@public.gmane.org> > --- > drivers/of/base.c | 8 ++++---- > 1 file changed, 4 insertions(+), 4 deletions(-) > > diff --git a/drivers/of/base.c b/drivers/of/base.c > index d8574ad..52f8506 100644 > --- a/drivers/of/base.c > +++ b/drivers/of/base.c > @@ -1847,6 +1847,10 @@ void of_alias_scan(void * (*dt_alloc)(u64 size, u64 align)) > { > struct property *pp; > > + of_aliases = of_find_node_by_path("/aliases"); > + if (!of_aliases) > + return; > + > of_chosen = of_find_node_by_path("/chosen"); > if (of_chosen == NULL) > of_chosen = of_find_node_by_path("/chosen@0"); > @@ -1862,10 +1866,6 @@ void of_alias_scan(void * (*dt_alloc)(u64 size, u64 align)) > of_stdout = of_find_node_by_path(name); > } > > - of_aliases = of_find_node_by_path("/aliases"); > - if (!of_aliases) > - return; > - Close, but not quite. The 'if (!of_aliases)' test should not be moved. Only the search for of_find_node_by_path(). I've fixed it up and applied. g. > for_each_property_of_node(of_aliases, pp) { > const char *start = pp->name; > const char *end = start + strlen(start); > -- > 1.8.3.1 -- To unsubscribe from this list: send the line "unsubscribe devicetree" in the body of a message to majordomo-u79uwXL29TY76Z2rM5mHXA@public.gmane.org More majordomo info at http://vger.kernel.org/majordomo-info.html ^ permalink raw reply [flat|nested] 3+ messages in thread
[parent not found: <20140908132956.646FEC40AE5-WNowdnHR2B42iJbIjFUEsiwD8/FfD2ys@public.gmane.org>]
* Re: [PATCH] of: make sure of_alias is initialized before accessing it [not found] ` <20140908132956.646FEC40AE5-WNowdnHR2B42iJbIjFUEsiwD8/FfD2ys@public.gmane.org> @ 2014-09-08 14:13 ` Laurentiu Tudor 0 siblings, 0 replies; 3+ messages in thread From: Laurentiu Tudor @ 2014-09-08 14:13 UTC (permalink / raw) To: Grant Likely, devicetree-u79uwXL29TY76Z2rM5mHXA, linux-kernel-u79uwXL29TY76Z2rM5mHXA, linuxppc-dev Cc: Laurentiu Tudor On 09/08/2014 04:29 PM, Grant Likely wrote: > On Wed, 27 Aug 2014 17:09:39 +0300, Laurentiu Tudor <b10716-KZfg59tc24xl57MIdRCFDg@public.gmane.org> wrote: >> Simply swap of_alias and of_chosen initialization so >> that of_alias ends up read first. This must be done >> because it is accessed couple of lines below when >> trying to initialize the of_stdout using the alias >> based legacy method. >> >> [Fixes a752ee5 - tty: Update hypervisor tty drivers to >> use core stdout parsing code] >> >> Signed-off-by: Laurentiu Tudor <Laurentiu.Tudor-KZfg59tc24xl57MIdRCFDg@public.gmane.org> >> Cc: Grant Likely <grant.likely-QSEj5FYQhm4dnm+yROfE0A@public.gmane.org> >> --- >> drivers/of/base.c | 8 ++++---- >> 1 file changed, 4 insertions(+), 4 deletions(-) >> >> diff --git a/drivers/of/base.c b/drivers/of/base.c >> index d8574ad..52f8506 100644 >> --- a/drivers/of/base.c >> +++ b/drivers/of/base.c >> @@ -1847,6 +1847,10 @@ void of_alias_scan(void * (*dt_alloc)(u64 size, u64 align)) >> { >> struct property *pp; >> >> + of_aliases = of_find_node_by_path("/aliases"); >> + if (!of_aliases) >> + return; >> + >> of_chosen = of_find_node_by_path("/chosen"); >> if (of_chosen == NULL) >> of_chosen = of_find_node_by_path("/chosen@0"); >> @@ -1862,10 +1866,6 @@ void of_alias_scan(void * (*dt_alloc)(u64 size, u64 align)) >> of_stdout = of_find_node_by_path(name); >> } >> >> - of_aliases = of_find_node_by_path("/aliases"); >> - if (!of_aliases) >> - return; >> - > > Close, but not quite. The 'if (!of_aliases)' test should not be moved. > Only the search for of_find_node_by_path(). Eek, completely missed this. Sorry. > I've fixed it up and applied. Thanks! --- Best Regards, Laurentiu -- To unsubscribe from this list: send the line "unsubscribe devicetree" in the body of a message to majordomo-u79uwXL29TY76Z2rM5mHXA@public.gmane.org More majordomo info at http://vger.kernel.org/majordomo-info.html ^ permalink raw reply [flat|nested] 3+ messages in thread
end of thread, other threads:[~2014-09-08 14:13 UTC | newest] Thread overview: 3+ messages (download: mbox.gz follow: Atom feed -- links below jump to the message on this page -- 2014-08-27 14:09 [PATCH] of: make sure of_alias is initialized before accessing it Laurentiu Tudor [not found] ` <53FDE6A3.3080303-KZfg59tc24xl57MIdRCFDg@public.gmane.org> 2014-09-08 13:29 ` Grant Likely [not found] ` <20140908132956.646FEC40AE5-WNowdnHR2B42iJbIjFUEsiwD8/FfD2ys@public.gmane.org> 2014-09-08 14:13 ` Laurentiu Tudor
This is a public inbox, see mirroring instructions for how to clone and mirror all data and code used for this inbox; as well as URLs for NNTP newsgroup(s).