]> git.baikalelectronics.ru Git - kernel.git/commit
dma: mv_xor: fix error handling path
authorThomas Petazzoni <thomas.petazzoni@free-electrons.com>
Thu, 22 Nov 2012 17:22:59 +0000 (18:22 +0100)
committerThomas Petazzoni <thomas.petazzoni@free-electrons.com>
Thu, 22 Nov 2012 17:22:59 +0000 (18:22 +0100)
commitd13bc8fb8a9cf3c6ebb87bde1b4af0865cdd3bae
tree72abb106516adf991b941b97ea4ed53c3294a8e9
parent407da96f0ff72c4ddf05c8d043e866bf47656710
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>
drivers/dma/mv_xor.c