[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: |
Peter Maydell |
Subject: |
Re: [Qemu-devel] [PATCH 3/6] device_tree: introduce qemu_fdt_node_path |
Date: |
Tue, 5 Jan 2016 17:55:37 +0000 |
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...
thanks
-- PMM