Devicetree
 help / color / mirror / Atom feed
* Re: [PATCH] of: fix incorrect return value of of_find_matching_node_and_match()
       [not found] ` <1358619642-23607-1-git-send-email-thomas.abraham-QSEj5FYQhm4dnm+yROfE0A@public.gmane.org>
@ 2013-01-20 21:50   ` Rob Herring
       [not found]     ` <50FC66BA.9030503-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org>
  0 siblings, 1 reply; 4+ messages in thread
From: Rob Herring @ 2013-01-20 21:50 UTC (permalink / raw)
  To: Thomas Abraham
  Cc: devicetree-discuss-uLR06cmDAlY/bJ5BZ2RsiQ@public.gmane.org,
	linux-arm-kernel-IAPFreCvJWM7uuMidbF8XUB+6BGkLq7r

On 01/19/2013 12:20 PM, Thomas Abraham wrote:
> The of_find_matching_node_and_match() function incorrectly sets the matched
> entry to 'matches' when the compatible value of a node matches one of the
> possible values. This results in incorrectly selecting the the first entry in
> the 'matches' list as the matched entry. Fix this by noting down the result of
> the call to of_match_node() and setting that as the matched entry.

Looks fine, but is this breaking something in 3.8 or can it wait for 3.9?

Rob

> 
> Signed-off-by: Thomas Abraham <thomas.abraham-QSEj5FYQhm4dnm+yROfE0A@public.gmane.org>
> ---
>  drivers/of/base.c |    6 ++++--
>  1 files changed, 4 insertions(+), 2 deletions(-)
> 
> diff --git a/drivers/of/base.c b/drivers/of/base.c
> index 2390ddb..960ae5b 100644
> --- a/drivers/of/base.c
> +++ b/drivers/of/base.c
> @@ -612,6 +612,7 @@ struct device_node *of_find_matching_node_and_match(struct device_node *from,
>  					const struct of_device_id **match)
>  {
>  	struct device_node *np;
> +	const struct of_device_id *m;
>  
>  	if (match)
>  		*match = NULL;
> @@ -619,9 +620,10 @@ struct device_node *of_find_matching_node_and_match(struct device_node *from,
>  	read_lock(&devtree_lock);
>  	np = from ? from->allnext : of_allnodes;
>  	for (; np; np = np->allnext) {
> -		if (of_match_node(matches, np) && of_node_get(np)) {
> +		m = of_match_node(matches, np);
> +		if (m && of_node_get(np)) {
>  			if (match)
> -				*match = matches;
> +				*match = m;
>  			break;
>  		}
>  	}
> 

^ permalink raw reply	[flat|nested] 4+ messages in thread

* Re: [PATCH] of: fix incorrect return value of of_find_matching_node_and_match()
       [not found]     ` <50FC66BA.9030503-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org>
@ 2013-01-20 21:56       ` Thomas Abraham
       [not found]         ` <CAJuYYwT++66UUT5wdZh=B=VC7s2=T4w0qO6G7CEG6eCHT5WBCg-JsoAwUIsXosN+BqQ9rBEUg@public.gmane.org>
  0 siblings, 1 reply; 4+ messages in thread
From: Thomas Abraham @ 2013-01-20 21:56 UTC (permalink / raw)
  To: Rob Herring
  Cc: devicetree-discuss-uLR06cmDAlY/bJ5BZ2RsiQ@public.gmane.org,
	linux-arm-kernel-IAPFreCvJWM7uuMidbF8XUB+6BGkLq7r

On 20 January 2013 13:50, Rob Herring <robherring2-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org> wrote:
> On 01/19/2013 12:20 PM, Thomas Abraham wrote:
>> The of_find_matching_node_and_match() function incorrectly sets the matched
>> entry to 'matches' when the compatible value of a node matches one of the
>> possible values. This results in incorrectly selecting the the first entry in
>> the 'matches' list as the matched entry. Fix this by noting down the result of
>> the call to of_match_node() and setting that as the matched entry.
>
> Looks fine, but is this breaking something in 3.8 or can it wait for 3.9?

Yes, it can wait for 3.9. I am using this function while adding device
tree support for timers on exynos platform which will probably merged
in 3.9.

Thanks,
Thomas.

>
> Rob
>
>>
>> Signed-off-by: Thomas Abraham <thomas.abraham-QSEj5FYQhm4dnm+yROfE0A@public.gmane.org>
>> ---
>>  drivers/of/base.c |    6 ++++--
>>  1 files changed, 4 insertions(+), 2 deletions(-)
>>
>> diff --git a/drivers/of/base.c b/drivers/of/base.c
>> index 2390ddb..960ae5b 100644
>> --- a/drivers/of/base.c
>> +++ b/drivers/of/base.c
>> @@ -612,6 +612,7 @@ struct device_node *of_find_matching_node_and_match(struct device_node *from,
>>                                       const struct of_device_id **match)
>>  {
>>       struct device_node *np;
>> +     const struct of_device_id *m;
>>
>>       if (match)
>>               *match = NULL;
>> @@ -619,9 +620,10 @@ struct device_node *of_find_matching_node_and_match(struct device_node *from,
>>       read_lock(&devtree_lock);
>>       np = from ? from->allnext : of_allnodes;
>>       for (; np; np = np->allnext) {
>> -             if (of_match_node(matches, np) && of_node_get(np)) {
>> +             m = of_match_node(matches, np);
>> +             if (m && of_node_get(np)) {
>>                       if (match)
>> -                             *match = matches;
>> +                             *match = m;
>>                       break;
>>               }
>>       }
>>

^ permalink raw reply	[flat|nested] 4+ messages in thread

* Re: [PATCH] of: fix incorrect return value of of_find_matching_node_and_match()
       [not found]         ` <CAJuYYwT++66UUT5wdZh=B=VC7s2=T4w0qO6G7CEG6eCHT5WBCg-JsoAwUIsXosN+BqQ9rBEUg@public.gmane.org>
@ 2013-01-21  3:27           ` Rob Herring
  2013-01-21  3:48             ` Thomas Abraham
  0 siblings, 1 reply; 4+ messages in thread
From: Rob Herring @ 2013-01-21  3:27 UTC (permalink / raw)
  To: Thomas Abraham
  Cc: devicetree-discuss-uLR06cmDAlY/bJ5BZ2RsiQ@public.gmane.org,
	linux-arm-kernel-IAPFreCvJWM7uuMidbF8XUB+6BGkLq7r

On 01/20/2013 03:56 PM, Thomas Abraham wrote:
> On 20 January 2013 13:50, Rob Herring <robherring2-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org> wrote:
>> On 01/19/2013 12:20 PM, Thomas Abraham wrote:
>>> The of_find_matching_node_and_match() function incorrectly sets the matched
>>> entry to 'matches' when the compatible value of a node matches one of the
>>> possible values. This results in incorrectly selecting the the first entry in
>>> the 'matches' list as the matched entry. Fix this by noting down the result of
>>> the call to of_match_node() and setting that as the matched entry.
>>
>> Looks fine, but is this breaking something in 3.8 or can it wait for 3.9?
> 
> Yes, it can wait for 3.9. I am using this function while adding device
> tree support for timers on exynos platform which will probably merged
> in 3.9.

Applied for 3.9. It's in my for-next branch on sources.calxeda.com. This
is a stable branch.

Rob

> 
> Thanks,
> Thomas.
> 
>>
>> Rob
>>
>>>
>>> Signed-off-by: Thomas Abraham <thomas.abraham-QSEj5FYQhm4dnm+yROfE0A@public.gmane.org>
>>> ---
>>>  drivers/of/base.c |    6 ++++--
>>>  1 files changed, 4 insertions(+), 2 deletions(-)
>>>
>>> diff --git a/drivers/of/base.c b/drivers/of/base.c
>>> index 2390ddb..960ae5b 100644
>>> --- a/drivers/of/base.c
>>> +++ b/drivers/of/base.c
>>> @@ -612,6 +612,7 @@ struct device_node *of_find_matching_node_and_match(struct device_node *from,
>>>                                       const struct of_device_id **match)
>>>  {
>>>       struct device_node *np;
>>> +     const struct of_device_id *m;
>>>
>>>       if (match)
>>>               *match = NULL;
>>> @@ -619,9 +620,10 @@ struct device_node *of_find_matching_node_and_match(struct device_node *from,
>>>       read_lock(&devtree_lock);
>>>       np = from ? from->allnext : of_allnodes;
>>>       for (; np; np = np->allnext) {
>>> -             if (of_match_node(matches, np) && of_node_get(np)) {
>>> +             m = of_match_node(matches, np);
>>> +             if (m && of_node_get(np)) {
>>>                       if (match)
>>> -                             *match = matches;
>>> +                             *match = m;
>>>                       break;
>>>               }
>>>       }
>>>

^ permalink raw reply	[flat|nested] 4+ messages in thread

* Re: [PATCH] of: fix incorrect return value of of_find_matching_node_and_match()
  2013-01-21  3:27           ` Rob Herring
@ 2013-01-21  3:48             ` Thomas Abraham
  0 siblings, 0 replies; 4+ messages in thread
From: Thomas Abraham @ 2013-01-21  3:48 UTC (permalink / raw)
  To: Rob Herring
  Cc: grant.likely, devicetree-discuss@lists.ozlabs.org,
	linux-arm-kernel, Stephen Warren

On 20 January 2013 19:27, Rob Herring <robherring2@gmail.com> wrote:
> On 01/20/2013 03:56 PM, Thomas Abraham wrote:
>> On 20 January 2013 13:50, Rob Herring <robherring2@gmail.com> wrote:
>>> On 01/19/2013 12:20 PM, Thomas Abraham wrote:
>>>> The of_find_matching_node_and_match() function incorrectly sets the matched
>>>> entry to 'matches' when the compatible value of a node matches one of the
>>>> possible values. This results in incorrectly selecting the the first entry in
>>>> the 'matches' list as the matched entry. Fix this by noting down the result of
>>>> the call to of_match_node() and setting that as the matched entry.
>>>
>>> Looks fine, but is this breaking something in 3.8 or can it wait for 3.9?
>>
>> Yes, it can wait for 3.9. I am using this function while adding device
>> tree support for timers on exynos platform which will probably merged
>> in 3.9.
>
> Applied for 3.9. It's in my for-next branch on sources.calxeda.com. This
> is a stable branch.
>
> Rob

Thank you Rob.

Regards,
Thomas.

^ permalink raw reply	[flat|nested] 4+ messages in thread

end of thread, other threads:[~2013-01-21  3:48 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
     [not found] <1358619642-23607-1-git-send-email-thomas.abraham@linaro.org>
     [not found] ` <1358619642-23607-1-git-send-email-thomas.abraham-QSEj5FYQhm4dnm+yROfE0A@public.gmane.org>
2013-01-20 21:50   ` [PATCH] of: fix incorrect return value of of_find_matching_node_and_match() Rob Herring
     [not found]     ` <50FC66BA.9030503-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org>
2013-01-20 21:56       ` Thomas Abraham
     [not found]         ` <CAJuYYwT++66UUT5wdZh=B=VC7s2=T4w0qO6G7CEG6eCHT5WBCg-JsoAwUIsXosN+BqQ9rBEUg@public.gmane.org>
2013-01-21  3:27           ` Rob Herring
2013-01-21  3:48             ` Thomas Abraham

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox