[alsa-devel] [PATCH v2 20/23] ASoC: tegra: tegra20_ac97.c: use devm_snd_soc_register_component()

Kuninori Morimoto kuninori.morimoto.gx at renesas.com
Fri Jun 28 06:11:04 CEST 2019


From: Kuninori Morimoto <kuninori.morimoto.gx at renesas.com>

We have devm_xxx version of snd_soc_register_component,
let's use it.

Signed-off-by: Kuninori Morimoto <kuninori.morimoto.gx at renesas.com>
---
v1 -> v2

	- no change

 sound/soc/tegra/tegra20_ac97.c | 10 +++-------
 1 file changed, 3 insertions(+), 7 deletions(-)

diff --git a/sound/soc/tegra/tegra20_ac97.c b/sound/soc/tegra/tegra20_ac97.c
index 7c359c4..ae94db4 100644
--- a/sound/soc/tegra/tegra20_ac97.c
+++ b/sound/soc/tegra/tegra20_ac97.c
@@ -377,8 +377,8 @@ static int tegra20_ac97_platform_probe(struct platform_device *pdev)
 		goto err_clk_disable_unprepare;
 	}
 
-	ret = snd_soc_register_component(&pdev->dev, &tegra20_ac97_component,
-					 &tegra20_ac97_dai, 1);
+	ret = devm_snd_soc_register_component(&pdev->dev,
+				&tegra20_ac97_component, &tegra20_ac97_dai, 1);
 	if (ret) {
 		dev_err(&pdev->dev, "Could not register DAI: %d\n", ret);
 		ret = -ENOMEM;
@@ -388,7 +388,7 @@ static int tegra20_ac97_platform_probe(struct platform_device *pdev)
 	ret = tegra_pcm_platform_register(&pdev->dev);
 	if (ret) {
 		dev_err(&pdev->dev, "Could not register PCM: %d\n", ret);
-		goto err_unregister_component;
+		goto err_clk_disable_unprepare;
 	}
 
 	/* XXX: crufty ASoC AC97 API - only one AC97 codec allowed */
@@ -396,8 +396,6 @@ static int tegra20_ac97_platform_probe(struct platform_device *pdev)
 
 	return 0;
 
-err_unregister_component:
-	snd_soc_unregister_component(&pdev->dev);
 err_clk_disable_unprepare:
 	clk_disable_unprepare(ac97->clk_ac97);
 err_clk_put:
@@ -410,8 +408,6 @@ static int tegra20_ac97_platform_remove(struct platform_device *pdev)
 {
 	struct tegra20_ac97 *ac97 = dev_get_drvdata(&pdev->dev);
 
-	snd_soc_unregister_component(&pdev->dev);
-
 	clk_disable_unprepare(ac97->clk_ac97);
 
 	snd_soc_set_ac97_ops(NULL);
-- 
2.7.4



More information about the Alsa-devel mailing list