* [PATCH v2] dmaengine: dw: Use devm_clk_get_optional_enabled() in dw_probe()
@ 2026-11-20 14:13 Markus Elfring
2026-11-20 16:37 ` Frank Li
0 siblings, 1 reply; 3+ messages in thread
From: Markus Elfring @ 2026-11-20 14:13 UTC (permalink / raw)
To: dmaengine, Andy Shevchenko, Frank Li, Vinod Koul, Viresh Kumar
Cc: LKML, kernel-janitors, Serge Semin
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
^ permalink raw reply related [flat|nested] 3+ messages in thread
* Re: [PATCH v2] dmaengine: dw: Use devm_clk_get_optional_enabled() in dw_probe()
2026-11-20 14:13 [PATCH v2] dmaengine: dw: Use devm_clk_get_optional_enabled() in dw_probe() Markus Elfring
@ 2026-11-20 16:37 ` Frank Li
2026-11-20 17:09 ` [v2] " Markus Elfring
0 siblings, 1 reply; 3+ messages in thread
From: Frank Li @ 2026-11-20 16:37 UTC (permalink / raw)
To: Markus Elfring
Cc: dmaengine, Andy Shevchenko, Frank Li, Vinod Koul, Viresh Kumar,
LKML, kernel-janitors, Serge Semin
On Fri, Nov 20, 2026 at 03:13:01PM +0100, Markus Elfring wrote:
> From: Markus Elfring <elfring@users.sourceforge.net>
> Date: Fri, 20 Nov 2026 14:23:13 +0100
Any tools issue ? your patch look strange. Why this information at body
>
> * Reuse existing functionality from devm_clk_get_optional_enabled()
> instead of keeping duplicate source code.
Needn't *
>
> * Omit a clk_disable_unprepare() call on an error handling path
> and in the implementation of the function “dw_remove”.
Clean up disable_unprepare() at error handling patch and dw_remove()
Frank
>
> 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
>
^ permalink raw reply [flat|nested] 3+ messages in thread
* Re: [v2] dmaengine: dw: Use devm_clk_get_optional_enabled() in dw_probe()
2026-11-20 16:37 ` Frank Li
@ 2026-11-20 17:09 ` Markus Elfring
0 siblings, 0 replies; 3+ messages in thread
From: Markus Elfring @ 2026-11-20 17:09 UTC (permalink / raw)
To: Frank Li, dmaengine
Cc: Frank Li, LKML, kernel-janitors, Andy Shevchenko, Serge Semin,
Vinod Koul, Viresh Kumar
>> From: Markus Elfring <elfring@users.sourceforge.net>
>> Date: Fri, 20 Nov 2026 14:23:13 +0100
>
> Any tools issue ? your patch look strange. Why this information at body
I am trying to provide some author information.
Regards,
Markus
^ permalink raw reply [flat|nested] 3+ messages in thread
end of thread, other threads:[~2026-11-20 17:09 UTC | newest]
Thread overview: 3+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2026-11-20 14:13 [PATCH v2] dmaengine: dw: Use devm_clk_get_optional_enabled() in dw_probe() Markus Elfring
2026-11-20 16:37 ` Frank Li
2026-11-20 17:09 ` [v2] " Markus Elfring
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox