[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: [Qemu-devel] [PATCH 3/6] device_tree: introduce qemu_fdt_node_path
From: |
Eric Auger |
Subject: |
Re: [Qemu-devel] [PATCH 3/6] device_tree: introduce qemu_fdt_node_path |
Date: |
Wed, 6 Jan 2016 09:43:14 +0100 |
User-agent: |
Mozilla/5.0 (X11; Linux x86_64; rv:38.0) Gecko/20100101 Thunderbird/38.4.0 |
On 01/05/2016 06:55 PM, Peter Maydell wrote:
> On 5 January 2016 at 16:20, Eric Auger <address@hidden> wrote:
>> Hi Peter,
>> On 12/18/2015 03:23 PM, Peter Maydell wrote:
>>> On 17 December 2015 at 12:29, Eric Auger <address@hidden> wrote:
>>>> This new helper routine returns the node path of a device
>>>> referred to by its node name and compat string.
>>>>
>>>> Signed-off-by: Eric Auger <address@hidden>
>
>>>> +
>>>> + *node_path = NULL;
>>>> + offset = fdt_node_offset_by_compatible(fdt, -1, compat);
>>>> + while (offset != -FDT_ERR_NOTFOUND) {
>>>> + if (offset < 0) {
>>>> + continue;
>>>
>>> I don't understand this continue -- if the fdt function returned any
>>> error other than -FDT_ERR_NOTFOUND then this will cause us to go
>>> into an infinite loop around this while(). Did you mean 'break' ?
>>> (Though if you just want to break then fixing the while condition
>>> would be better.)
>> My first understanding of the API was fdt_node_offset_by_compatible
>> would increment the offset even if an error occurred; so I envisioned to
>> continue parsing the tree, looking for another node with same features.
>
> Your code doesn't call fdt_node_offset_by_compatible again
> in the case where it's trying to continue, though...
I'll be damned, got it now!
Thanks
Eric
>
> thanks
> -- PMM
>