On 5 January 2016 at 16:20, Eric Auger <eric.au...@linaro.org> wrote: > Hi Peter, > On 12/18/2015 03:23 PM, Peter Maydell wrote: >> On 17 December 2015 at 12:29, Eric Auger <eric.au...@linaro.org> 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 <eric.au...@linaro.org>
>>> + >>> + *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