Re: [PATCH] of/irq: add missing of_node_put() for interrupt parent node

From: Rob Herring
Date: Wed Jan 18 2023 - 11:26:14 EST



On Tue, 17 Jan 2023 15:49:29 +0100, Clément Léger wrote:
> After calling of_irq_parse_one(), the node provided in the of_phandle_args
> has a refcount increment by one. Add missing of_node_put in of_irq_get()
> to decrement the refcount once used.
>
> Signed-off-by: Clément Léger <clement.leger@xxxxxxxxxxx>
> ---
>
> While debugging a refcount problem with OF_DYNAMIC enabled (which is
> actually the only case were node refcount are really used), I noticed that
> platform_get_irq() was actually incrementing the refcount of an interrupt
> controller node. Digging into that function shows that it calls
> of_irq_get() which calls of_irq_parse_one() and finally of_irq_parse_raw().
> Since it seems sane that the node returned in the of_phandle_args has a
> refcount incremented, I thought it is better to put the of_node_put() in
> the user even though it was hard to find any user doing so.
>
> drivers/of/irq.c | 12 +++++++++---
> 1 file changed, 9 insertions(+), 3 deletions(-)
>

Applied, thanks!