[PATCH] powerpc/powermac/pfunc_base: Fix refcount leak bug in macio_gpio_init_one()

Benjamin Herrenschmidt benh at kernel.crashing.org
Tue Aug 2 14:51:08 AEST 2022


On Sat, 2022-07-16 at 15:31 +0800, Liang He wrote:
> We should call of_node_put() for the reference 'gparent' escaped
> out of the for_each_child_of_node() as it has increased the refcount.

Same comment as before. That stuff happens once at boot, there's never
any dynamic allocation/deallocation of these, they just don't matter,
but feel free .... :-)

> Fixes: 5b9ca526917b ("[PATCH] 3/5 powerpc: Add platform functions
> interpreter")
> Signed-off-by: Liang He <windhl at 126.com>
> ---
>  arch/powerpc/platforms/powermac/pfunc_base.c | 2 ++
>  1 file changed, 2 insertions(+)
> 
> diff --git a/arch/powerpc/platforms/powermac/pfunc_base.c
> b/arch/powerpc/platforms/powermac/pfunc_base.c
> index 9c2947a3edd5..085e0ad20eba 100644
> --- a/arch/powerpc/platforms/powermac/pfunc_base.c
> +++ b/arch/powerpc/platforms/powermac/pfunc_base.c
> @@ -136,6 +136,8 @@ static void __init macio_gpio_init_one(struct
> macio_chip *macio)
>  	for_each_child_of_node(gparent, gp)
>  		pmf_do_functions(gp, NULL, 0, PMF_FLAGS_ON_INIT, NULL);
>  
> +	of_node_put(gparent);
> +
>  	/* Note: We do not at this point implement the "at sleep" or
> "at wake"
>  	 * functions. I yet to find any for GPIOs anyway
>  	 */



More information about the Linuxppc-dev mailing list