dmaengine: sun6i: Fix memory leaks
authorMaxime Ripard <maxime.ripard@free-electrons.com>
Wed, 30 Jul 2014 08:30:23 +0000 (10:30 +0200)
committerVinod Koul <vinod.koul@intel.com>
Wed, 30 Jul 2014 13:44:17 +0000 (19:14 +0530)
commit4fbd804e009ae9dff29dcb1fbfa0aaffd3992880
tree13ca8845a4d581ce90a25e779cb87667d078babf
parent174427c1bb9e7810743f55a90a64da2c29d67b0b
dmaengine: sun6i: Fix memory leaks

The sun6i_dma_prep_memcpy and sun6i_dma_prep_slave_sg functions were both
leaking the descriptor they allocated if an  error was happening after a
successful dma_pool_alloc call.

It also fixes a memleak that was happening in the scatter gather list
traversal, that was allocating as much descriptor as there was scatter gather
items, but only freeing the current descriptor if an error was to arise.

Reported-by: Dan Carpenter <dan.carpenter@oracle.com>
Signed-off-by: Maxime Ripard <maxime.ripard@free-electrons.com>
Signed-off-by: Vinod Koul <vinod.koul@intel.com>
drivers/dma/sun6i-dma.c