diff options
author | Thomas Petazzoni <thomas.petazzoni@free-electrons.com> | 2012-11-22 12:22:59 -0500 |
---|---|---|
committer | Thomas Petazzoni <thomas.petazzoni@free-electrons.com> | 2012-11-22 12:22:59 -0500 |
commit | 73d9cdca1ced6ab32be363b58699039bd82b062a (patch) | |
tree | 72abb106516adf991b941b97ea4ed53c3294a8e9 /drivers/dma/mv_xor.c | |
parent | f8eb9e7d2a198fe3a0f76d9e5b374160c26e4621 (diff) |
dma: mv_xor: fix error handling path
The ->probe() function of the mv_xor function contains in its error
handling code a loop to cleanup the XOR channels that had been
successfully initialized if some other XOR channel fails to be
initialized. It does that by traveling the list of XOR channels, and
cleanup those for which the pointer is not NULL.
However, since the mv_xor_channel_add() function return a PTR_ERR
style value, the pointer is not NULL on error. So, when handling the
error of a given channel initialization, we cleanup this channel
initialization and mark this channel entry as NULL in the array. This
allows the remaining of the cleanup (for other channels) to work
properly.
Signed-off-by: Thomas Petazzoni <thomas.petazzoni@free-electrons.com>
Diffstat (limited to 'drivers/dma/mv_xor.c')
-rw-r--r-- | drivers/dma/mv_xor.c | 1 |
1 files changed, 1 insertions, 0 deletions
diff --git a/drivers/dma/mv_xor.c b/drivers/dma/mv_xor.c index f2edd6a5536e..9659e58fc8b2 100644 --- a/drivers/dma/mv_xor.c +++ b/drivers/dma/mv_xor.c | |||
@@ -1322,6 +1322,7 @@ static int __devinit mv_xor_probe(struct platform_device *pdev) | |||
1322 | cap_mask, irq); | 1322 | cap_mask, irq); |
1323 | if (IS_ERR(xordev->channels[i])) { | 1323 | if (IS_ERR(xordev->channels[i])) { |
1324 | ret = PTR_ERR(xordev->channels[i]); | 1324 | ret = PTR_ERR(xordev->channels[i]); |
1325 | xordev->channels[i] = NULL; | ||
1325 | irq_dispose_mapping(irq); | 1326 | irq_dispose_mapping(irq); |
1326 | goto err_channel_add; | 1327 | goto err_channel_add; |
1327 | } | 1328 | } |