[PATCH] gpio: rockchip: fix OF node leak in probe()
Bartosz Golaszewski
brgl at bgdev.pl
Mon Sep 2 03:23:32 PDT 2024
On Mon, Aug 26, 2024 at 5:08 PM Krzysztof Kozlowski
<krzysztof.kozlowski at linaro.org> wrote:
>
> Driver code is leaking OF node reference from of_get_parent() in
> probe().
>
> Fixes: 936ee2675eee ("gpio/rockchip: add driver for rockchip gpio")
> Signed-off-by: Krzysztof Kozlowski <krzysztof.kozlowski at linaro.org>
> ---
> drivers/gpio/gpio-rockchip.c | 1 +
> 1 file changed, 1 insertion(+)
>
> diff --git a/drivers/gpio/gpio-rockchip.c b/drivers/gpio/gpio-rockchip.c
> index 0bd339813110..365ab947983c 100644
> --- a/drivers/gpio/gpio-rockchip.c
> +++ b/drivers/gpio/gpio-rockchip.c
> @@ -713,6 +713,7 @@ static int rockchip_gpio_probe(struct platform_device *pdev)
> return -ENODEV;
>
> pctldev = of_pinctrl_get(pctlnp);
> + of_node_put(pctlnp);
> if (!pctldev)
> return -EPROBE_DEFER;
>
> --
> 2.43.0
>
How about using __free(device_node)?
Bart
More information about the Linux-rockchip
mailing list