diff mbox

[v4,0/4] Bugfix for of_match_node ordering

Message ID 20140220101240.GA3745@pek-khao-d1.corp.ad.wrs.com (mailing list archive)
State New, archived
Headers show

Commit Message

Kevin Hao Feb. 20, 2014, 10:12 a.m. UTC
On Thu, Feb 20, 2014 at 02:09:08PM +0530, Sachin Kamat wrote:
> Hi Grant,
> 
> I observe the following boot failure with today's (next-20140220) linux-next
> tree on Exynos based boards with the default exynos_defconfig.

Does this help?



Thanks,
Kevin

Comments

Sachin Kamat Feb. 20, 2014, 10:27 a.m. UTC | #1
Hi Kevin,

On 20 February 2014 15:42, Kevin Hao <haokexin@gmail.com> wrote:
> On Thu, Feb 20, 2014 at 02:09:08PM +0530, Sachin Kamat wrote:
>> Hi Grant,
>>
>> I observe the following boot failure with today's (next-20140220) linux-next
>> tree on Exynos based boards with the default exynos_defconfig.
>
> Does this help?

The below patch works for me. Thanks for the fix.

>
> diff --git a/drivers/of/base.c b/drivers/of/base.c
> index 8a27fc907ab6..9cc893530b9a 100644
> --- a/drivers/of/base.c
> +++ b/drivers/of/base.c
> @@ -381,12 +381,16 @@ static int __of_device_is_compatible(const struct device_node *device,
>
>         /* Compatible match has highest priority */
>         if (compat && compat[0]) {
> -               of_property_for_each_string(device, "compatible", prop, cp) {
> +               prop = __of_find_property(device, "compatible", NULL);
> +               if (!prop)
> +                       return 0;
> +
> +               for (cp = of_prop_next_string(prop, NULL); cp;
> +                               cp = of_prop_next_string(prop, cp), index++) {
>                         if (of_compat_cmp(cp, compat, strlen(compat)) == 0) {
>                                 score = INT_MAX/2 - (index << 2);
>                                 break;
>                         }
> -                       index++;
>                 }
>                 if (!score)
>                         return 0;
>
>
> Thanks,
> Kevin
Kevin Hao Feb. 20, 2014, 10:55 a.m. UTC | #2
On Thu, Feb 20, 2014 at 03:57:07PM +0530, Sachin Kamat wrote:
> Hi Kevin,
> 
> On 20 February 2014 15:42, Kevin Hao <haokexin@gmail.com> wrote:
> > On Thu, Feb 20, 2014 at 02:09:08PM +0530, Sachin Kamat wrote:
> >> Hi Grant,
> >>
> >> I observe the following boot failure with today's (next-20140220) linux-next
> >> tree on Exynos based boards with the default exynos_defconfig.
> >
> > Does this help?
> 
> The below patch works for me. Thanks for the fix.

Thanks Sachin.

Hi Grant,

I assume you would fold this change into the original patch. But if you want
a separate patch, please let me know.

Thanks,
Kevin
Sachin Kamat Feb. 20, 2014, 11:13 a.m. UTC | #3
On 20 February 2014 16:25, Kevin Hao <haokexin@gmail.com> wrote:
> On Thu, Feb 20, 2014 at 03:57:07PM +0530, Sachin Kamat wrote:
>> Hi Kevin,
>>
>> On 20 February 2014 15:42, Kevin Hao <haokexin@gmail.com> wrote:
>> > On Thu, Feb 20, 2014 at 02:09:08PM +0530, Sachin Kamat wrote:
>> >> Hi Grant,
>> >>
>> >> I observe the following boot failure with today's (next-20140220) linux-next
>> >> tree on Exynos based boards with the default exynos_defconfig.
>> >
>> > Does this help?
>>
>> The below patch works for me. Thanks for the fix.
>
> Thanks Sachin.
>
> Hi Grant,
>
> I assume you would fold this change into the original patch. But if you want
> a separate patch, please let me know.
>
> Thanks,
> Kevin

FWIW, On Exynos platform
Tested-by: Sachin Kamat <sachin.kamat@linaro.org>
Grant Likely Feb. 20, 2014, 11:53 a.m. UTC | #4
On Thu, 20 Feb 2014 18:12:40 +0800, Kevin Hao <haokexin@gmail.com> wrote:
> On Thu, Feb 20, 2014 at 02:09:08PM +0530, Sachin Kamat wrote:
> > Hi Grant,
> > 
> > I observe the following boot failure with today's (next-20140220) linux-next
> > tree on Exynos based boards with the default exynos_defconfig.
> 
> Does this help?

I've merged this in. I could get my unicore test platform to fail to
boot by turning on lock debugging. I'll leave that option on from now
one.

I've pushed this out to the following branch. Please test and report. It
will also be picked up by linux-next tomorrow.

git://git.secretlab.ca/git/linux devicetree/merge

> 
> diff --git a/drivers/of/base.c b/drivers/of/base.c
> index 8a27fc907ab6..9cc893530b9a 100644
> --- a/drivers/of/base.c
> +++ b/drivers/of/base.c
> @@ -381,12 +381,16 @@ static int __of_device_is_compatible(const struct device_node *device,
>  
>  	/* Compatible match has highest priority */
>  	if (compat && compat[0]) {
> -		of_property_for_each_string(device, "compatible", prop, cp) {
> +		prop = __of_find_property(device, "compatible", NULL);
> +		if (!prop)
> +			return 0;

The above 2 lines are unnecessary. of_prop_next_string() will return
NULL if prop is NULL.

g.

> +
> +		for (cp = of_prop_next_string(prop, NULL); cp;
> +				cp = of_prop_next_string(prop, cp), index++) {
>  			if (of_compat_cmp(cp, compat, strlen(compat)) == 0) {
>  				score = INT_MAX/2 - (index << 2);
>  				break;
>  			}
> -			index++;
>  		}
>  		if (!score)
>  			return 0;
> 
> 
> Thanks,
> Kevin

--
To unsubscribe from this list: send the line "unsubscribe linux-samsung-soc" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
diff mbox

Patch

diff --git a/drivers/of/base.c b/drivers/of/base.c
index 8a27fc907ab6..9cc893530b9a 100644
--- a/drivers/of/base.c
+++ b/drivers/of/base.c
@@ -381,12 +381,16 @@  static int __of_device_is_compatible(const struct device_node *device,
 
 	/* Compatible match has highest priority */
 	if (compat && compat[0]) {
-		of_property_for_each_string(device, "compatible", prop, cp) {
+		prop = __of_find_property(device, "compatible", NULL);
+		if (!prop)
+			return 0;
+
+		for (cp = of_prop_next_string(prop, NULL); cp;
+				cp = of_prop_next_string(prop, cp), index++) {
 			if (of_compat_cmp(cp, compat, strlen(compat)) == 0) {
 				score = INT_MAX/2 - (index << 2);
 				break;
 			}
-			index++;
 		}
 		if (!score)
 			return 0;