From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from eggs.gnu.org ([2001:4830:134:3::10]:49547) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1aGjgr-0004Vu-4N for qemu-devel@nongnu.org; Wed, 06 Jan 2016 03:43:33 -0500 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1aGjgn-0006xh-T2 for qemu-devel@nongnu.org; Wed, 06 Jan 2016 03:43:33 -0500 Received: from mail-wm0-x236.google.com ([2a00:1450:400c:c09::236]:35010) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1aGjgn-0006xV-KQ for qemu-devel@nongnu.org; Wed, 06 Jan 2016 03:43:29 -0500 Received: by mail-wm0-x236.google.com with SMTP id f206so51303239wmf.0 for ; Wed, 06 Jan 2016 00:43:28 -0800 (PST) References: <1450355367-14818-1-git-send-email-eric.auger@linaro.org> <1450355367-14818-4-git-send-email-eric.auger@linaro.org> <568BED5B.7030505@linaro.org> From: Eric Auger Message-ID: <568CD3A2.4030807@linaro.org> Date: Wed, 6 Jan 2016 09:43:14 +0100 MIME-Version: 1.0 In-Reply-To: Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 7bit Subject: Re: [Qemu-devel] [PATCH 3/6] device_tree: introduce qemu_fdt_node_path List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , To: Peter Maydell Cc: Baptiste Reynal , Thomas Huth , eric.auger@st.com, Patch Tracking , Peter Crosthwaite , QEMU Developers , Alex Williamson , Suravee Suthikulpanit , Paolo Bonzini , thomas.lendacky@amd.com, =?UTF-8?Q?Alex_Benn=c3=a9e?= , Christoffer Dall , David Gibson On 01/05/2016 06:55 PM, Peter Maydell wrote: > On 5 January 2016 at 16:20, Eric Auger wrote: >> Hi Peter, >> On 12/18/2015 03:23 PM, Peter Maydell wrote: >>> On 17 December 2015 at 12:29, Eric Auger 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 > >>>> + >>>> + *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 >