[<prev] [next>] [<thread-prev] [day] [month] [year] [list]
Message-ID: <CAMRc=Mcfs0=CKv4YXpg5h+u6aoeLsEAz7PgUPUk5y6RHbKydZg@mail.gmail.com>
Date: Mon, 2 Jan 2023 13:01:47 +0100
From: Bartosz Golaszewski <brgl@...ev.pl>
To: Miaoqian Lin <linmq006@...il.com>
Cc: Linus Walleij <linus.walleij@...aro.org>,
Palmer Dabbelt <palmer@...belt.com>,
Paul Walmsley <paul.walmsley@...ive.com>,
Marc Zyngier <maz@...nel.org>,
Yash Shah <yash.shah@...ive.com>,
Atish Patra <atishp@...shpatra.org>,
"Wesley W. Terpstra" <wesley@...ive.com>,
linux-gpio@...r.kernel.org, linux-riscv@...ts.infradead.org,
linux-kernel@...r.kernel.org
Subject: Re: [PATCH] gpio: sifive: Fix refcount leak in sifive_gpio_probe
On Mon, Jan 2, 2023 at 9:20 AM Miaoqian Lin <linmq006@...il.com> wrote:
>
> of_irq_find_parent() returns a node pointer with refcount incremented,
> We should use of_node_put() on it when not needed anymore.
> Add missing of_node_put() to avoid refcount leak.
>
> Fixes: 96868dce644d ("gpio/sifive: Add GPIO driver for SiFive SoCs")
> Signed-off-by: Miaoqian Lin <linmq006@...il.com>
> ---
> drivers/gpio/gpio-sifive.c | 1 +
> 1 file changed, 1 insertion(+)
>
> diff --git a/drivers/gpio/gpio-sifive.c b/drivers/gpio/gpio-sifive.c
> index 238f3210970c..bc5660f61c57 100644
> --- a/drivers/gpio/gpio-sifive.c
> +++ b/drivers/gpio/gpio-sifive.c
> @@ -215,6 +215,7 @@ static int sifive_gpio_probe(struct platform_device *pdev)
> return -ENODEV;
> }
> parent = irq_find_host(irq_parent);
> + of_node_put(irq_parent);
> if (!parent) {
> dev_err(dev, "no IRQ parent domain\n");
> return -ENODEV;
> --
> 2.25.1
>
Good catch, applied!
Bart
Powered by blists - more mailing lists