mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
* [PATCH] ASoC: rockchip: pdm: Use devm_clk_get_enabled() in rockchip_pdm_probe()
@ 2026-11-22 13:48 Markus Elfring
  0 siblings, 0 replies; only message in thread
From: Markus Elfring @ 2026-11-22 13:48 UTC (permalink / raw)
  To: linux-sound, linux-rockchip, linux-arm-kernel,
	Heiko Stübner, Jaroslav Kysela, Liam Girdwood, Mark Brown,
	Takashi Iwai
  Cc: LKML, kernel-janitors, Andy Shevchenko, Christophe Jaillet,
	Florian Fainelli, Frank Li, Michal Simek

From: Markus Elfring <elfring@users.sourceforge.net>
Date: Sun, 22 Nov 2026 14:36:46 +0100

* Use a devm_clk_get_enabled() call once more instead of keeping duplicate
  source code.

* Omit a clk_disable_unprepare() call on an error handling path
  and in the implementation of the function “rockchip_pdm_remove”.

This issue was detected by using the Coccinelle software.

Signed-off-by: Markus Elfring <elfring@users.sourceforge.net>
---
 sound/soc/rockchip/rockchip_pdm.c | 10 +---------
 1 file changed, 1 insertion(+), 9 deletions(-)

diff --git a/sound/soc/rockchip/rockchip_pdm.c b/sound/soc/rockchip/rockchip_pdm.c
index a0a89f5bddd9..9d3bf9d8ce97 100644
--- a/sound/soc/rockchip/rockchip_pdm.c
+++ b/sound/soc/rockchip/rockchip_pdm.c
@@ -617,14 +617,10 @@ static int rockchip_pdm_probe(struct platform_device *pdev)
 	if (IS_ERR(pdm->clk))
 		return PTR_ERR(pdm->clk);
 
-	pdm->hclk = devm_clk_get(&pdev->dev, "pdm_hclk");
+	pdm->hclk = devm_clk_get_enabled(&pdev->dev, "pdm_hclk");
 	if (IS_ERR(pdm->hclk))
 		return PTR_ERR(pdm->hclk);
 
-	ret = clk_prepare_enable(pdm->hclk);
-	if (ret)
-		return ret;
-
 	pm_runtime_enable(&pdev->dev);
 	if (!pm_runtime_enabled(&pdev->dev)) {
 		ret = rockchip_pdm_runtime_resume(&pdev->dev);
@@ -656,9 +652,6 @@ static int rockchip_pdm_probe(struct platform_device *pdev)
 		rockchip_pdm_runtime_suspend(&pdev->dev);
 err_pm_disable:
 	pm_runtime_disable(&pdev->dev);
-
-	clk_disable_unprepare(pdm->hclk);
-
 	return ret;
 }
 
@@ -671,7 +664,6 @@ static void rockchip_pdm_remove(struct platform_device *pdev)
 		rockchip_pdm_runtime_suspend(&pdev->dev);
 
 	clk_disable_unprepare(pdm->clk);
-	clk_disable_unprepare(pdm->hclk);
 }
 
 static int rockchip_pdm_suspend(struct device *dev)
-- 
2.56.1


^ permalink raw reply	[flat|nested] only message in thread

only message in thread, other threads:[~2026-11-22 13:49 UTC | newest]

Thread overview: (only message) (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2026-11-22 13:48 [PATCH] ASoC: rockchip: pdm: Use devm_clk_get_enabled() in rockchip_pdm_probe() Markus Elfring

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox

all inboxes | Powered by JetHome®