Skip to content

Commit

Permalink
dma: mv_xor: fix error handling path
Browse files Browse the repository at this point in the history
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>
  • Loading branch information
Thomas Petazzoni committed Nov 22, 2012
1 parent f8eb9e7 commit 73d9cdc
Showing 1 changed file with 1 addition and 0 deletions.
1 change: 1 addition & 0 deletions drivers/dma/mv_xor.c
Original file line number Diff line number Diff line change
Expand Up @@ -1322,6 +1322,7 @@ static int __devinit mv_xor_probe(struct platform_device *pdev)
cap_mask, irq);
if (IS_ERR(xordev->channels[i])) {
ret = PTR_ERR(xordev->channels[i]);
xordev->channels[i] = NULL;
irq_dispose_mapping(irq);
goto err_channel_add;
}
Expand Down

0 comments on commit 73d9cdc

Please sign in to comment.