Linux Sound subsystem development
 help / color / mirror / Atom feed
From: phucduc.bui@gmail.com
To: Mark Brown <broonie@kernel.org>
Cc: Liam Girdwood <lgirdwood@gmail.com>,
	Jaroslav Kysela <perex@perex.cz>, Takashi Iwai <tiwai@suse.com>,
	Kees Cook <kees+treewide@kernel.org>,
	Jihed Chaibi <jihed.chaibi.dev@gmail.com>,
	Kuninori Morimoto <kuninori.morimoto.gx@renesas.com>,
	linux-sound@vger.kernel.org, linux-kernel@vger.kernel.org,
	bui duc phuc <phucduc.bui@gmail.com>
Subject: [PATCH 2/2] ASoC: cirrus: ep93xx-i2s: Use devm_clk_get()
Date: Tue, 17 Nov 2026 11:21:02 +0700	[thread overview]
Message-ID: <20261117042102.12442-3-phucduc.bui@gmail.com> (raw)
In-Reply-To: <20261117042102.12442-1-phucduc.bui@gmail.com>

From: bui duc phuc <phucduc.bui@gmail.com>

Use devm_clk_get() to manage clock references automatically,
simplifying the error path in probe() and allowing the remove()
callback to be dropped.

Signed-off-by: bui duc phuc <phucduc.bui@gmail.com>
---
 sound/soc/cirrus/ep93xx-i2s.c | 47 ++++++++---------------------------
 1 file changed, 11 insertions(+), 36 deletions(-)

diff --git a/sound/soc/cirrus/ep93xx-i2s.c b/sound/soc/cirrus/ep93xx-i2s.c
index 8dcfc6717e19..f2d55763a02d 100644
--- a/sound/soc/cirrus/ep93xx-i2s.c
+++ b/sound/soc/cirrus/ep93xx-i2s.c
@@ -471,54 +471,30 @@ static int ep93xx_i2s_probe(struct platform_device *pdev)
 			return err;
 	}
 
-	info->mclk = clk_get(&pdev->dev, "mclk");
-	if (IS_ERR(info->mclk)) {
-		err = PTR_ERR(info->mclk);
-		goto fail;
-	}
+	info->mclk = devm_clk_get(&pdev->dev, "mclk");
+	if (IS_ERR(info->mclk))
+		return PTR_ERR(info->mclk);
 
-	info->sclk = clk_get(&pdev->dev, "sclk");
-	if (IS_ERR(info->sclk)) {
-		err = PTR_ERR(info->sclk);
-		goto fail_put_mclk;
-	}
+	info->sclk = devm_clk_get(&pdev->dev, "sclk");
+	if (IS_ERR(info->sclk))
+		return PTR_ERR(info->sclk);
 
-	info->lrclk = clk_get(&pdev->dev, "lrclk");
-	if (IS_ERR(info->lrclk)) {
-		err = PTR_ERR(info->lrclk);
-		goto fail_put_sclk;
-	}
+	info->lrclk = devm_clk_get(&pdev->dev, "lrclk");
+	if (IS_ERR(info->lrclk))
+		return PTR_ERR(info->lrclk);
 
 	dev_set_drvdata(&pdev->dev, info);
 
 	err = devm_snd_soc_register_component(&pdev->dev, &ep93xx_i2s_component,
 					 &ep93xx_i2s_dai, 1);
 	if (err)
-		goto fail_put_lrclk;
+		return err;
 
 	err = devm_ep93xx_pcm_platform_register(&pdev->dev);
 	if (err)
-		goto fail_put_lrclk;
+		return err;
 
 	return 0;
-
-fail_put_lrclk:
-	clk_put(info->lrclk);
-fail_put_sclk:
-	clk_put(info->sclk);
-fail_put_mclk:
-	clk_put(info->mclk);
-fail:
-	return err;
-}
-
-static void ep93xx_i2s_remove(struct platform_device *pdev)
-{
-	struct ep93xx_i2s_info *info = dev_get_drvdata(&pdev->dev);
-
-	clk_put(info->lrclk);
-	clk_put(info->sclk);
-	clk_put(info->mclk);
 }
 
 static const struct of_device_id ep93xx_i2s_of_ids[] = {
@@ -529,7 +505,6 @@ MODULE_DEVICE_TABLE(of, ep93xx_i2s_of_ids);
 
 static struct platform_driver ep93xx_i2s_driver = {
 	.probe	= ep93xx_i2s_probe,
-	.remove = ep93xx_i2s_remove,
 	.driver	= {
 		.name	= "ep93xx-i2s",
 		.of_match_table = ep93xx_i2s_of_ids,
-- 
2.43.0


      parent reply	other threads:[~2026-11-17  4:21 UTC|newest]

Thread overview: 3+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2026-11-17  4:21 [PATCH 0/2] ASoC: cirrus: ep93xx-i2s: Clean up resource management phucduc.bui
2026-11-17  4:21 ` [PATCH 1/2] ASoC: cirrus: ep93xx-i2s: Simplify platform_get_irq() error check phucduc.bui
2026-11-17  4:21 ` phucduc.bui [this message]

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20261117042102.12442-3-phucduc.bui@gmail.com \
    --to=phucduc.bui@gmail.com \
    --cc=broonie@kernel.org \
    --cc=jihed.chaibi.dev@gmail.com \
    --cc=kees+treewide@kernel.org \
    --cc=kuninori.morimoto.gx@renesas.com \
    --cc=lgirdwood@gmail.com \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-sound@vger.kernel.org \
    --cc=perex@perex.cz \
    --cc=tiwai@suse.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox