[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <7fa7f07f-d1e1-1e43-992c-4981c5810284@traphandler.com>
Date: Sat, 4 Mar 2023 11:34:39 +0100
From: Jean-Jacques Hiblot <jjhiblot@...phandler.com>
To: Geert Uytterhoeven <geert@...ux-m68k.org>
CC: <saravanak@...gle.com>, <clement.leger@...tlin.com>,
Magnus Damm <magnus.damm@...il.com>,
Russell King <linux@...linux.org.uk>,
Michael Ellerman <mpe@...erman.id.au>,
Nicholas Piggin <npiggin@...il.com>,
Christophe Leroy <christophe.leroy@...roup.eu>,
<zajec5@...il.com>, Daniel Lezcano <daniel.lezcano@...aro.org>,
Thomas Gleixner <tglx@...utronix.de>,
Claudiu Beznea <claudiu.beznea@...rochip.com>,
Marc Zyngier <maz@...nel.org>, <afaerber@...e.de>,
Manivannan Sadhasivam <mani@...nel.org>,
Palmer Dabbelt <palmer@...belt.com>,
Paul Walmsley <paul.walmsley@...ive.com>,
Chen-Yu Tsai <wens@...e.org>,
Jernej Skrabec <jernej.skrabec@...il.com>,
Samuel Holland <samuel@...lland.org>,
Rob Herring <robh+dt@...nel.org>,
Frank Rowand <frowand.list@...il.com>,
Bjorn Helgaas <bhelgaas@...gle.com>,
Nishanth Menon <nm@...com>, <ssantosh@...nel.org>,
<mathias.nyman@...el.com>, <gregkh@...uxfoundation.org>,
<thierry.reding@...il.com>, <jonathanh@...dia.com>,
<linux-renesas-soc@...r.kernel.org>,
<linux-arm-kernel@...ts.infradead.org>,
<linux-kernel@...r.kernel.org>, <linuxppc-dev@...ts.ozlabs.org>,
<linux-wireless@...r.kernel.org>,
<linux-actions@...ts.infradead.org>,
<linux-riscv@...ts.infradead.org>, <linux-sunxi@...ts.linux.dev>,
<devicetree@...r.kernel.org>, <linux-pci@...r.kernel.org>,
<linux-usb@...r.kernel.org>, <linux-tegra@...r.kernel.org>
Subject: Re: [PATCH 2/3] of: irq: make callers of of_irq_parse_one() release
the device node
On 02/03/2023 08:49, Geert Uytterhoeven wrote:
> Hi Jean-Jacques,
>
> Thanks for your patch!
>
> On Wed, Mar 1, 2023 at 7:53 PM Jean-Jacques Hiblot
> <jjhiblot@...phandler.com> wrote:
>> of_irq_parse_one() does a get() on the device node returned in out_irq->np.
>> Callers of of_irq_parse_one() must do a put() when they are done with it.
>
> What does "be done with it" really mean here?
>
>> Signed-off-by: Jean-Jacques Hiblot <jjhiblot@...phandler.com>
>
>> --- a/arch/arm/mach-shmobile/regulator-quirk-rcar-gen2.c
>> +++ b/arch/arm/mach-shmobile/regulator-quirk-rcar-gen2.c
>> @@ -184,6 +184,7 @@ static int __init rcar_gen2_regulator_quirk(void)
>> kfree(quirk);
>> continue;
>> }
>> + of_node_put(argsa->np);
>
> The quirk object, which is a container of argsa, is still used below,
> and stored in a linked list. I agree argsa->np is not dereferenced,
> but the pointer itself is still compared to other pointers.
Hi Geert,
I fail to see when the pointers are compared. It looks to me that only
the args are compared. Am I missing something ?
In any case, looking more closely at the code, I guess that indeed the
of_node_put() shouldn't be added here because this code expects that the
nodes never go away. That is probably a good assertion in case of PMICs
JJ
> IIUIC, calling of_node_put() might cause the reference count to drop to
> zero, and the underlying struct node object to be deallocated.
> So when a future reference to the same DT node will be taken, a new
> struct node object will be allocated, and the pointer comparison below
> will fail?
>
> Or am I missing something?
>
> Gr{oetje,eeting}s,
>
> Geert
>
Powered by blists - more mailing lists