f5940fbb1d3d0437ce3add43b294bcb1b4ac337b
[openwrt/staging/wigyori.git] / target / linux / mvebu / patches-3.8 / 002-dma_mv_xor_fix_error_handling.patch
1 From: Thomas Petazzoni <thomas.petazzoni@free-electrons.com>
2
3 When mv_xor_channel_add() fails for one XOR channel, we jump to the
4 err_channel_add label to clean up all previous channels that had been
5 initialized correctly. Unfortunately, while handling this error
6 condition, we were disposing the IRQ mapping before calling
7 mv_xor_channel_remove() (which does the free_irq()), which is
8 incorrect.
9
10 Instead, do things properly in the reverse order of the
11 initialization: first remove the XOR channel (so that free_irq() is
12 done), and then dispose the IRQ mapping.
13
14 This avoids ugly warnings when for some reason one of the XOR channel
15 fails to initialize.
16
17 Signed-off-by: Thomas Petazzoni <thomas.petazzoni@free-electrons.com>
18 ---
19 drivers/dma/mv_xor.c | 2 +-
20 1 file changed, 1 insertion(+), 1 deletion(-)
21
22 diff --git a/drivers/dma/mv_xor.c b/drivers/dma/mv_xor.c
23 index ac71f55..cc5d23d 100644
24 --- a/drivers/dma/mv_xor.c
25 +++ b/drivers/dma/mv_xor.c
26 @@ -1361,9 +1361,9 @@ static int mv_xor_probe(struct platform_device *pdev)
27 err_channel_add:
28 for (i = 0; i < MV_XOR_MAX_CHANNELS; i++)
29 if (xordev->channels[i]) {
30 + mv_xor_channel_remove(xordev->channels[i]);
31 if (pdev->dev.of_node)
32 irq_dispose_mapping(xordev->channels[i]->irq);
33 - mv_xor_channel_remove(xordev->channels[i]);
34 }
35
36 clk_disable_unprepare(xordev->clk);
37 --
38 1.7.10.4