Re: [PATCH] gpio: gpiolib-of.c: Add of_node_put() before break

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



sob., 6 lip 2019 o 15:34 Nishka Dasgupta <nishkadg.linux@xxxxxxxxx> napisał(a):
>
> Each iteration of for_each_child_of_node puts the previous node, but in
> the case of a break from the middle of the loop, there is no put, thus
> causing a memory leak. Hence add an of_node_put before the break.
> Issue found with Coccinelle.
>
> Signed-off-by: Nishka Dasgupta <nishkadg.linux@xxxxxxxxx>
> ---
>  drivers/gpio/gpiolib-of.c | 1 +
>  1 file changed, 1 insertion(+)
>
> diff --git a/drivers/gpio/gpiolib-of.c b/drivers/gpio/gpiolib-of.c
> index aec7bd86ae7e..c9325efc1783 100644
> --- a/drivers/gpio/gpiolib-of.c
> +++ b/drivers/gpio/gpiolib-of.c
> @@ -154,6 +154,7 @@ static void of_gpio_flags_quirks(struct device_node *np,
>                                                         of_node_full_name(child));
>                                         *flags |= OF_GPIO_ACTIVE_LOW;
>                                 }
> +                               of_node_put(child);
>                                 break;
>                         }
>                 }
> --
> 2.19.1
>

Applied for fixes with a slightly changed commit message. Thanks!

Bartosz




[Index of Archives]     [Linux SPI]     [Linux Kernel]     [Linux ARM (vger)]     [Linux ARM MSM]     [Linux Omap]     [Linux Arm]     [Linux Tegra]     [Fedora ARM]     [Linux for Samsung SOC]     [eCos]     [Linux Fastboot]     [Gcc Help]     [Git]     [DCCP]     [IETF Announce]     [Security]     [Linux MIPS]     [Yosemite Campsites]

  Powered by Linux