* [PATCH] dmaengine: lgm: Fix an error handling path in intel_ldma_probe()
@ 2022-05-22 17:41 Christophe JAILLET
2022-07-06 5:23 ` Vinod Koul
0 siblings, 1 reply; 2+ messages in thread
From: Christophe JAILLET @ 2022-05-22 17:41 UTC (permalink / raw)
To: Vinod Koul, Philipp Zabel, Amireddy Mallikarjuna reddy
Cc: linux-kernel, kernel-janitors, Christophe JAILLET, dmaengine
ldma_clk_disable() calls both:
clk_disable_unprepare(d->core_clk);
reset_control_assert(d->rst);
So, should devm_reset_control_get_optional() fail, core_clk should not
be prepare_enable'd before it, otherwise it will never be
disable_unprepare'd.
Reorder the code to handle the error handling path as expected.
Fixes: 32d31c79a1a4 ("dmaengine: Add Intel LGM SoC DMA support.")
Signed-off-by: Christophe JAILLET <christophe.jaillet@wanadoo.fr>
---
drivers/dma/lgm/lgm-dma.c | 3 ++-
1 file changed, 2 insertions(+), 1 deletion(-)
diff --git a/drivers/dma/lgm/lgm-dma.c b/drivers/dma/lgm/lgm-dma.c
index efe8bd3a0e2a..9b9184f964be 100644
--- a/drivers/dma/lgm/lgm-dma.c
+++ b/drivers/dma/lgm/lgm-dma.c
@@ -1593,11 +1593,12 @@ static int intel_ldma_probe(struct platform_device *pdev)
d->core_clk = devm_clk_get_optional(dev, NULL);
if (IS_ERR(d->core_clk))
return PTR_ERR(d->core_clk);
- clk_prepare_enable(d->core_clk);
d->rst = devm_reset_control_get_optional(dev, NULL);
if (IS_ERR(d->rst))
return PTR_ERR(d->rst);
+
+ clk_prepare_enable(d->core_clk);
reset_control_deassert(d->rst);
ret = devm_add_action_or_reset(dev, ldma_clk_disable, d);
--
2.34.1
^ permalink raw reply related [flat|nested] 2+ messages in thread
* Re: [PATCH] dmaengine: lgm: Fix an error handling path in intel_ldma_probe()
2022-05-22 17:41 [PATCH] dmaengine: lgm: Fix an error handling path in intel_ldma_probe() Christophe JAILLET
@ 2022-07-06 5:23 ` Vinod Koul
0 siblings, 0 replies; 2+ messages in thread
From: Vinod Koul @ 2022-07-06 5:23 UTC (permalink / raw)
To: Christophe JAILLET
Cc: Philipp Zabel, Amireddy Mallikarjuna reddy, linux-kernel,
kernel-janitors, dmaengine
On 22-05-22, 19:41, Christophe JAILLET wrote:
> ldma_clk_disable() calls both:
> clk_disable_unprepare(d->core_clk);
> reset_control_assert(d->rst);
>
> So, should devm_reset_control_get_optional() fail, core_clk should not
> be prepare_enable'd before it, otherwise it will never be
> disable_unprepare'd.
>
> Reorder the code to handle the error handling path as expected.
Applied, thanks
--
~Vinod
^ permalink raw reply [flat|nested] 2+ messages in thread
end of thread, other threads:[~2022-07-06 5:23 UTC | newest]
Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2022-05-22 17:41 [PATCH] dmaengine: lgm: Fix an error handling path in intel_ldma_probe() Christophe JAILLET
2022-07-06 5:23 ` Vinod Koul
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.