diff mbox series

[-next] ASoC: tegra: Add missing of_node_put() in tegra_machine_parse_phandle()

Message ID 1623929447-4335-1-git-send-email-zou_wei@huawei.com
State Not Applicable
Headers show
Series [-next] ASoC: tegra: Add missing of_node_put() in tegra_machine_parse_phandle() | expand

Commit Message

Samuel Zou June 17, 2021, 11:30 a.m. UTC
The function is missing a of_node_put on node, fix this by adding the call
before returning.

Reported-by: Hulk Robot <hulkci@huawei.com>
Signed-off-by: Zou Wei <zou_wei@huawei.com>
---
 sound/soc/tegra/tegra_asoc_machine.c | 5 ++++-
 1 file changed, 4 insertions(+), 1 deletion(-)

Comments

Dmitry Osipenko June 17, 2021, 12:36 p.m. UTC | #1
17.06.2021 14:30, Zou Wei пишет:
> The function is missing a of_node_put on node, fix this by adding the call
> before returning.
> 
> Reported-by: Hulk Robot <hulkci@huawei.com>
> Signed-off-by: Zou Wei <zou_wei@huawei.com>
> ---
>  sound/soc/tegra/tegra_asoc_machine.c | 5 ++++-
>  1 file changed, 4 insertions(+), 1 deletion(-)
> 
> diff --git a/sound/soc/tegra/tegra_asoc_machine.c b/sound/soc/tegra/tegra_asoc_machine.c
> index 397f326..cba55ca 100644
> --- a/sound/soc/tegra/tegra_asoc_machine.c
> +++ b/sound/soc/tegra/tegra_asoc_machine.c
> @@ -336,9 +336,12 @@ tegra_machine_parse_phandle(struct device *dev, const char *name)
>  	}
>  
>  	err = devm_add_action_or_reset(dev, tegra_machine_node_release, np);
> -	if (err)
> +	if (err) {
> +		of_node_put(np);
>  		return ERR_PTR(err);
> +	}
>  
> +	of_node_put(np);
>  	return np;
>  }
>  
> 

You haven't tried to check what this auto-generated patch does, haven't
you? I assume it's auto-generated because it's a nonsense.
diff mbox series

Patch

diff --git a/sound/soc/tegra/tegra_asoc_machine.c b/sound/soc/tegra/tegra_asoc_machine.c
index 397f326..cba55ca 100644
--- a/sound/soc/tegra/tegra_asoc_machine.c
+++ b/sound/soc/tegra/tegra_asoc_machine.c
@@ -336,9 +336,12 @@  tegra_machine_parse_phandle(struct device *dev, const char *name)
 	}
 
 	err = devm_add_action_or_reset(dev, tegra_machine_node_release, np);
-	if (err)
+	if (err) {
+		of_node_put(np);
 		return ERR_PTR(err);
+	}
 
+	of_node_put(np);
 	return np;
 }