From: Markus Elfring <Markus.Elfring@web.de>
To: dmaengine@vger.kernel.org,
Andy Shevchenko <andriy.shevchenko@linux.intel.com>,
Frank Li <Frank.Li@kernel.org>, Vinod Koul <vkoul@kernel.org>,
Viresh Kumar <vireshk@kernel.org>
Cc: LKML <linux-kernel@vger.kernel.org>,
kernel-janitors@vger.kernel.org,
Serge Semin <fancer.lancer@gmail.com>
Subject: [PATCH v2] dmaengine: dw: Use devm_clk_get_optional_enabled() in dw_probe()
Date: Fri, 20 Nov 2026 15:13:01 +0100 [thread overview]
Message-ID: <4267a49d-89b0-4564-b22b-995de017f52b@web.de> (raw)
From: Markus Elfring <elfring@users.sourceforge.net>
Date: Fri, 20 Nov 2026 14:23:13 +0100
* Reuse existing functionality from devm_clk_get_optional_enabled()
instead of keeping duplicate source code.
* Omit a clk_disable_unprepare() call on an error handling path
and in the implementation of the function “dw_remove”.
This issue was detected by using the Coccinelle software.
Signed-off-by: Markus Elfring <elfring@users.sourceforge.net>
---
V2:
Andy Shevchenko and Frank Li requested further adjustments according to
the proposed changes.
drivers/dma/dw/platform.c | 7 +------
1 file changed, 1 insertion(+), 6 deletions(-)
diff --git a/drivers/dma/dw/platform.c b/drivers/dma/dw/platform.c
index 7e76391475ac..13c44ee5e047 100644
--- a/drivers/dma/dw/platform.c
+++ b/drivers/dma/dw/platform.c
@@ -64,12 +64,9 @@ static int dw_probe(struct platform_device *pdev)
data->chip = chip;
- chip->clk = devm_clk_get_optional(chip->dev, "hclk");
+ chip->clk = devm_clk_get_optional_enabled(chip->dev, "hclk");
if (IS_ERR(chip->clk))
return PTR_ERR(chip->clk);
- ret = clk_prepare_enable(chip->clk);
- if (ret)
- return ret;
pm_runtime_enable(&pdev->dev);
@@ -87,7 +84,6 @@ static int dw_probe(struct platform_device *pdev)
err_dw_dma_probe:
pm_runtime_disable(&pdev->dev);
- clk_disable_unprepare(chip->clk);
return ret;
}
@@ -106,7 +102,6 @@ static void dw_remove(struct platform_device *pdev)
dev_warn(chip->dev, "can't remove device properly: %d\n", ret);
pm_runtime_disable(&pdev->dev);
- clk_disable_unprepare(chip->clk);
}
static void dw_shutdown(struct platform_device *pdev)
--
2.56.1
reply other threads:[~2026-11-20 14:13 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=4267a49d-89b0-4564-b22b-995de017f52b@web.de \
--to=markus.elfring@web.de \
--cc=Frank.Li@kernel.org \
--cc=andriy.shevchenko@linux.intel.com \
--cc=dmaengine@vger.kernel.org \
--cc=fancer.lancer@gmail.com \
--cc=kernel-janitors@vger.kernel.org \
--cc=linux-kernel@vger.kernel.org \
--cc=vireshk@kernel.org \
--cc=vkoul@kernel.org \
/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®