LKML Archive on lore.kernel.org
help / color / mirror / Atom feed
* [PATCH -next] ASoC: mediatek: mt8195: Add missing of_node_put()
@ 2021-09-11  8:12 Bixuan Cui
  2021-09-15  3:07 ` Trevor Wu
  2021-09-15 15:21 ` Mark Brown
  0 siblings, 2 replies; 4+ messages in thread
From: Bixuan Cui @ 2021-09-11  8:12 UTC (permalink / raw)
  To: linux-mediatek, linux-arm-kernel, linux-kernel
  Cc: lgirdwood, broonie, perex, tiwai, matthias.bgg, trevor.wu, alsa-devel

The platform_node is returned by of_parse_phandle() should have
of_node_put() before return.

Reported-by: Hulk Robot <hulkci@huawei.com>
Signed-off-by: Bixuan Cui <cuibixuan@huawei.com>
---
 sound/soc/mediatek/mt8195/mt8195-mt6359-rt1019-rt5682.c | 6 +++++-
 1 file changed, 5 insertions(+), 1 deletion(-)

diff --git a/sound/soc/mediatek/mt8195/mt8195-mt6359-rt1019-rt5682.c b/sound/soc/mediatek/mt8195/mt8195-mt6359-rt1019-rt5682.c
index c97ace7387b4..8cd8450409e8 100644
--- a/sound/soc/mediatek/mt8195/mt8195-mt6359-rt1019-rt5682.c
+++ b/sound/soc/mediatek/mt8195/mt8195-mt6359-rt1019-rt5682.c
@@ -1041,8 +1041,10 @@ static int mt8195_mt6359_rt1019_rt5682_dev_probe(struct platform_device *pdev)
 	}
 
 	priv = devm_kzalloc(&pdev->dev, sizeof(*priv), GFP_KERNEL);
-	if (!priv)
+	if (!priv) {
+		of_node_put(platform_node);
 		return -ENOMEM;
+	}
 
 	snd_soc_card_set_drvdata(card, priv);
 
@@ -1050,6 +1052,8 @@ static int mt8195_mt6359_rt1019_rt5682_dev_probe(struct platform_device *pdev)
 	if (ret)
 		dev_err(&pdev->dev, "%s snd_soc_register_card fail %d\n",
 			__func__, ret);
+
+	of_node_put(platform_node);
 	return ret;
 }
 
-- 
2.17.1


^ permalink raw reply	[flat|nested] 4+ messages in thread

* Re: [PATCH -next] ASoC: mediatek: mt8195: Add missing of_node_put()
  2021-09-11  8:12 [PATCH -next] ASoC: mediatek: mt8195: Add missing of_node_put() Bixuan Cui
@ 2021-09-15  3:07 ` Trevor Wu
  2021-09-15  3:35   ` Bixuan Cui
  2021-09-15 15:21 ` Mark Brown
  1 sibling, 1 reply; 4+ messages in thread
From: Trevor Wu @ 2021-09-15  3:07 UTC (permalink / raw)
  To: Bixuan Cui, linux-mediatek, linux-arm-kernel, linux-kernel
  Cc: lgirdwood, broonie, perex, tiwai, matthias.bgg, alsa-devel

Hi Bixuan,

Thanks for catching that.
I found there are other usages of of_parse_phandle() in the file.
Will you handle them together?
If not, I will prepare a patch to fix them after this patch is merged.

Thanks,
Trevor

On Sat, 2021-09-11 at 16:12 +0800, Bixuan Cui wrote:
> The platform_node is returned by of_parse_phandle() should have
> of_node_put() before return.
> 
> Reported-by: Hulk Robot <hulkci@huawei.com>
> Signed-off-by: Bixuan Cui <cuibixuan@huawei.com>
> ---
>  sound/soc/mediatek/mt8195/mt8195-mt6359-rt1019-rt5682.c | 6 +++++-
>  1 file changed, 5 insertions(+), 1 deletion(-)
> 
> diff --git a/sound/soc/mediatek/mt8195/mt8195-mt6359-rt1019-rt5682.c
> b/sound/soc/mediatek/mt8195/mt8195-mt6359-rt1019-rt5682.c
> index c97ace7387b4..8cd8450409e8 100644
> --- a/sound/soc/mediatek/mt8195/mt8195-mt6359-rt1019-rt5682.c
> +++ b/sound/soc/mediatek/mt8195/mt8195-mt6359-rt1019-rt5682.c
> @@ -1041,8 +1041,10 @@ static int
> mt8195_mt6359_rt1019_rt5682_dev_probe(struct platform_device *pdev)
>  	}
>  
>  	priv = devm_kzalloc(&pdev->dev, sizeof(*priv), GFP_KERNEL);
> -	if (!priv)
> +	if (!priv) {
> +		of_node_put(platform_node);
>  		return -ENOMEM;
> +	}
>  
>  	snd_soc_card_set_drvdata(card, priv);
>  
> @@ -1050,6 +1052,8 @@ static int
> mt8195_mt6359_rt1019_rt5682_dev_probe(struct platform_device *pdev)
>  	if (ret)
>  		dev_err(&pdev->dev, "%s snd_soc_register_card fail
> %d\n",
>  			__func__, ret);
> +
> +	of_node_put(platform_node);
>  	return ret;
>  }
>  


^ permalink raw reply	[flat|nested] 4+ messages in thread

* Re: [PATCH -next] ASoC: mediatek: mt8195: Add missing of_node_put()
  2021-09-15  3:07 ` Trevor Wu
@ 2021-09-15  3:35   ` Bixuan Cui
  0 siblings, 0 replies; 4+ messages in thread
From: Bixuan Cui @ 2021-09-15  3:35 UTC (permalink / raw)
  To: Trevor Wu, linux-mediatek, linux-arm-kernel, linux-kernel
  Cc: lgirdwood, broonie, perex, tiwai, matthias.bgg, alsa-devel



On 2021/9/15 11:07, Trevor Wu wrote:
> Thanks for catching that.
> I found there are other usages of of_parse_phandle() in the file.
> Will you handle them together?
> If not, I will prepare a patch to fix them after this patch is merged.
Hi,
You can send a v2 patch with your fixes base on my patch. The sign-off-by plus the two of us.

Thanks,
Bixuan Cui

> 
> Thanks,
> Trevor

^ permalink raw reply	[flat|nested] 4+ messages in thread

* Re: [PATCH -next] ASoC: mediatek: mt8195: Add missing of_node_put()
  2021-09-11  8:12 [PATCH -next] ASoC: mediatek: mt8195: Add missing of_node_put() Bixuan Cui
  2021-09-15  3:07 ` Trevor Wu
@ 2021-09-15 15:21 ` Mark Brown
  1 sibling, 0 replies; 4+ messages in thread
From: Mark Brown @ 2021-09-15 15:21 UTC (permalink / raw)
  To: linux-arm-kernel, linux-kernel, Bixuan Cui, linux-mediatek
  Cc: Mark Brown, matthias.bgg, alsa-devel, tiwai, trevor.wu, lgirdwood, perex

On Sat, 11 Sep 2021 16:12:46 +0800, Bixuan Cui wrote:
> The platform_node is returned by of_parse_phandle() should have
> of_node_put() before return.
> 
> 

Applied to

   https://git.kernel.org/pub/scm/linux/kernel/git/broonie/sound.git for-next

Thanks!

[1/1] ASoC: mediatek: mt8195: Add missing of_node_put()
      commit: b2fc2c92d2fd34d93268f677e514936f50dd6b5c

All being well this means that it will be integrated into the linux-next
tree (usually sometime in the next 24 hours) and sent to Linus during
the next merge window (or sooner if it is a bug fix), however if
problems are discovered then the patch may be dropped or reverted.

You may get further e-mails resulting from automated or manual testing
and review of the tree, please engage with people reporting problems and
send followup patches addressing any issues that are reported if needed.

If any updates are required or you are submitting further changes they
should be sent as incremental updates against current git, existing
patches will not be replaced.

Please add any relevant lists and maintainers to the CCs when replying
to this mail.

Thanks,
Mark

^ permalink raw reply	[flat|nested] 4+ messages in thread

end of thread, other threads:[~2021-09-15 15:22 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2021-09-11  8:12 [PATCH -next] ASoC: mediatek: mt8195: Add missing of_node_put() Bixuan Cui
2021-09-15  3:07 ` Trevor Wu
2021-09-15  3:35   ` Bixuan Cui
2021-09-15 15:21 ` Mark Brown

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).