Skip to contentSkip to conversation

ASoC: mediatek: mt8195: Add missing of_node_put()

PATCH In review Bixuan Cui 3 participants 4 messages Sep 11, 2021 – Sep 15, 2021

Subsystems (3)
lore
Share & tools
lore

Bixuan Cui

author
#0 lore raw

PATCH 1/1 ASoC: mediatek: mt8195: Add missing of_node_put()

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

---
 sound/soc/mediatek/mt8195/mt8195-mt6359-rt1019-rt5682.c | 6 +++++-
 1 file changed, 5 insertions(+), 1 deletion(-)
sound/soc/mediatek/mt8195/mt8195-mt6359-rt1019-rt5682.c +5 -1
index c97ace7387b4..8cd8450409e8 100644
@@ -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;
 }
 
Signature · 7 lines
2.17.1


_______________________________________________
Linux-mediatek mailing list
[email protected]
http://lists.infradead.org/mailman/listinfo/linux-mediatek
#1 lore raw

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

Quoted 38 lines · Bixuan Cui

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

---
 sound/soc/mediatek/mt8195/mt8195-mt6359-rt1019-rt5682.c | 6 +++++-
 1 file changed, 5 insertions(+), 1 deletion(-)
sound/soc/mediatek/mt8195/mt8195-mt6359-rt1019-rt5682.c +5 -1
index c97ace7387b4..8cd8450409e8 100644
@@ -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;

}

author
#2 lore raw
Quoted 4 lines · Trevor Wu

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

Quoted 3 lines

Thanks,
Trevor

maintainer
#3 lore raw
In reply to Bixuan Cui
Quoted 4 lines · Bixuan Cui

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