[PATCH] ASoC: rockchip: pdm: Use devm_clk_get_enabled() in rockchip_pdm_probe()
From: Markus Elfring
Date: Sun Nov 22 2026 - 08:49:54 EST
From: Markus Elfring <elfring@xxxxxxxxxxxxxxxxxxxxx>
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@xxxxxxxxxxxxxxxxxxxxx>
---
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