Skip to contentSkip to conversation

ASoC: rockchip: pdm: Use devm_clk_get_enabled() in rockchip_pdm_probe()

PATCH New Markus Elfring 1 participant 1 message Nov 22

Subsystems (4)
lore
Share & tools
lore
#0 lore raw

PATCH 1/1 ASoC: rockchip: pdm: Use devm_clk_get_enabled() in rockchip_pdm_probe()

From: Markus Elfring <[email protected]>
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.

---
 sound/soc/rockchip/rockchip_pdm.c | 10 +---------
 1 file changed, 1 insertion(+), 9 deletions(-)
sound/soc/rockchip/rockchip_pdm.c +1 -9
index a0a89f5bddd9..9d3bf9d8ce97 100644
@@ -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)
Signature · 1 line
2.56.1