[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <af8c128a-ff6c-4441-9ab5-c0401900db76@lunn.ch>
Date: Mon, 26 Aug 2024 01:28:46 +0200
From: Andrew Lunn <andrew@...n.ch>
To: Jinjie Ruan <ruanjinjie@...wei.com>
Cc: Jakub Kicinski <kuba@...nel.org>, f.fainelli@...il.com,
olteanv@...il.com, davem@...emloft.net, edumazet@...gle.com,
pabeni@...hat.com, netdev@...r.kernel.org,
linux-kernel@...r.kernel.org
Subject: Re: [PATCH -next] net: dsa: Simplify with scoped for each OF child
loop
On Fri, Aug 23, 2024 at 02:35:04PM +0800, Jinjie Ruan wrote:
>
>
> On 2024/8/22 22:51, Jakub Kicinski wrote:
> > On Thu, 22 Aug 2024 10:07:25 +0800 Jinjie Ruan wrote:
> >> On 2024/8/22 8:18, Jakub Kicinski wrote:
> >>> On Tue, 20 Aug 2024 14:58:04 +0800 Jinjie Ruan wrote:
> >>>> Use scoped for_each_available_child_of_node_scoped() when iterating over
> >>>> device nodes to make code a bit simpler.
> >>>
> >>> Could you add more info here that confirms this works with gotos?
> >>> I don't recall the details but I thought sometimes the scoped
> >>> constructs don't do well with gotos. I checked 5 random uses
> >>> of this loop and 4 of them didn't have gotos.
> >>
> >> Hi, Jakub
> >>
> >> From what I understand, for_each_available_child_of_node_scoped() is not
> >> related to gotos, it only let the iterating child node self-declared and
> >> automatic release, so the of_node_put(iterating_child_node) can be removed.
> >
> > Could you either test it or disasm the code to double check, please?
>
> Hi, Jakub, I test it with a fake device node on QEMU with a simple
> example using for_each_available_child_of_node_scoped() and goto out of
> the scope of for_each_available_child_of_node_scoped(), the
> of_node_put(child) has been called successfully.
What compiler version?
Please test with 5.1
https://www.kernel.org/doc/html/next/process/changes.html
Andrew
Powered by blists - more mailing lists