mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
From: Markus Elfring <Markus.Elfring@web.de>
To: linux-sound@vger.kernel.org, linux-rockchip@lists.infradead.org,
	linux-arm-kernel@lists.infradead.org,
	"Heiko Stübner" <heiko@sntech.de>,
	"Jaroslav Kysela" <perex@perex.cz>,
	"Liam Girdwood" <lgirdwood@gmail.com>,
	"Mark Brown" <broonie@kernel.org>,
	"Takashi Iwai" <tiwai@suse.com>
Cc: LKML <linux-kernel@vger.kernel.org>,
	kernel-janitors@vger.kernel.org,
	Andy Shevchenko <andriy.shevchenko@linux.intel.com>,
	Christophe Jaillet <christophe.jaillet@wanadoo.fr>,
	Florian Fainelli <f.fainelli@gmail.com>,
	Frank Li <Frank.Li@kernel.org>,
	Michal Simek <michal.simek@amd.com>
Subject: [PATCH] ASoC: rockchip: pdm: Use devm_clk_get_enabled() in rockchip_pdm_probe()
Date: Sun, 22 Nov 2026 14:48:47 +0100	[thread overview]
Message-ID: <01ed94d3-18c9-4c31-bbef-f97b1ae35ced@web.de> (raw)

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


                 reply	other threads:[~2026-11-22 13:49 UTC|newest]

Thread overview: [no followups] expand[flat|nested]  mbox.gz  Atom feed

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=01ed94d3-18c9-4c31-bbef-f97b1ae35ced@web.de \
    --to=markus.elfring@web.de \
    --cc=Frank.Li@kernel.org \
    --cc=andriy.shevchenko@linux.intel.com \
    --cc=broonie@kernel.org \
    --cc=christophe.jaillet@wanadoo.fr \
    --cc=f.fainelli@gmail.com \
    --cc=heiko@sntech.de \
    --cc=kernel-janitors@vger.kernel.org \
    --cc=lgirdwood@gmail.com \
    --cc=linux-arm-kernel@lists.infradead.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-rockchip@lists.infradead.org \
    --cc=linux-sound@vger.kernel.org \
    --cc=michal.simek@amd.com \
    --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

all inboxes | Powered by JetHome®