9bee8acded6678bb51e959792d6406dd1a409bdc
[openwrt/svn-archive/archive.git] / target / linux / mvebu / patches-3.8 / 003-dma_mv_xor_fix_error_handling_clocks.patch
1 From: Thomas Petazzoni <thomas.petazzoni@free-electrons.com>
2
3 When a channel fails to initialize, we release all ressources,
4 including clocks. However, a XOR unit is not necessarily associated to
5 a clock (some variants of Marvell SoCs have a clock for XOR units,
6 some don't), so we shouldn't unconditionally be releasing the clock.
7
8 Instead, just like we do in the mv_xor_remove() function, we should
9 check if one clock was found before releasing it.
10
11 Signed-off-by: Thomas Petazzoni <thomas.petazzoni@free-electrons.com>
12 ---
13 drivers/dma/mv_xor.c | 7 +++++--
14 1 file changed, 5 insertions(+), 2 deletions(-)
15
16 diff --git a/drivers/dma/mv_xor.c b/drivers/dma/mv_xor.c
17 index cc5d23d..e17fad0 100644
18 --- a/drivers/dma/mv_xor.c
19 +++ b/drivers/dma/mv_xor.c
20 @@ -1366,8 +1366,11 @@ err_channel_add:
21 irq_dispose_mapping(xordev->channels[i]->irq);
22 }
23
24 - clk_disable_unprepare(xordev->clk);
25 - clk_put(xordev->clk);
26 + if (!IS_ERR(xordev->clk)) {
27 + clk_disable_unprepare(xordev->clk);
28 + clk_put(xordev->clk);
29 + }
30 +
31 return ret;
32 }
33
34 --
35 1.7.10.4