[<prev] [next>] [<thread-prev] [day] [month] [year] [list]
Message-ID: <Yot15lTDH8n7+xh5@hovoldconsulting.com>
Date: Mon, 23 May 2022 13:54:14 +0200
From: Johan Hovold <johan@...nel.org>
To: cgel.zte@...il.com
Cc: thierry.reding@...il.com, jonathanh@...dia.com,
linux-tegra@...r.kernel.org, linux-kernel@...r.kernel.org,
Minghao Chi <chi.minghao@....com.cn>,
Zeal Robot <zealci@....com.cn>
Subject: Re: [PATCH] soc/tegra: Avoid leak OF node on error
On Mon, May 23, 2022 at 11:12:21AM +0000, cgel.zte@...il.com wrote:
> From: Minghao Chi <chi.minghao@....com.cn>
>
> The OF node should be put before returning error in tegra_init_soc(),
> otherwise node's refcount will be leaked.
>
> Reported-by: Zeal Robot <zealci@....com.cn>
> Signed-off-by: Minghao Chi <chi.minghao@....com.cn>
> ---
> drivers/soc/tegra/fuse/fuse-tegra.c | 3 +--
> 1 file changed, 1 insertion(+), 2 deletions(-)
>
> diff --git a/drivers/soc/tegra/fuse/fuse-tegra.c b/drivers/soc/tegra/fuse/fuse-tegra.c
> index b0a8405dbdb1..ab3e4dc6dc6e 100644
> --- a/drivers/soc/tegra/fuse/fuse-tegra.c
> +++ b/drivers/soc/tegra/fuse/fuse-tegra.c
> @@ -612,11 +612,10 @@ static int __init tegra_init_soc(void)
>
> /* make sure we're running on Tegra */
> np = of_find_matching_node(NULL, tegra_fuse_match);
> + of_node_put(np);
> if (!np)
> return 0;
>
> - of_node_put(np);
> -
> soc = tegra_soc_device_register();
> if (IS_ERR(soc)) {
> pr_err("failed to register SoC device: %ld\n", PTR_ERR(soc));
NAK
Powered by blists - more mailing lists