drivers/soc/tegra/fuse/fuse-tegra.c | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-)
From: Minghao Chi <chi.minghao@zte.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@zte.com.cn>
Signed-off-by: Minghao Chi <chi.minghao@zte.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));
--
2.25.1
On Mon, May 23, 2022 at 11:12:21AM +0000, cgel.zte@gmail.com wrote:
> From: Minghao Chi <chi.minghao@zte.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@zte.com.cn>
> Signed-off-by: Minghao Chi <chi.minghao@zte.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
© 2016 - 2026 Red Hat, Inc.