aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorRussell King - ARM Linux <linux@arm.linux.org.uk>2011-01-03 17:31:45 -0500
committerDan Williams <dan.j.williams@intel.com>2011-01-04 22:16:10 -0500
commitdafa73171be8dd31b485f5839e3376b1ca908e24 (patch)
tree70d6d14b7be6543cbfe777a523c75dc0a332c402
parentbf072af461c166964fb110cfcafccd752fbb4c64 (diff)
ARM: PL08x: fix a leak when preparing TXDs
If we fail to allocate the LLI, the prep_* function will return NULL. However, the TXD we allocated will not be placed on any list, nor will it be freed - we'll just drop all references to it. Make sure we free it rather than leaking TXDs. Signed-off-by: Russell King <rmk+kernel@arm.linux.org.uk> Acked-by: Linus Walleij <linus.walleij@stericsson.com> Signed-off-by: Dan Williams <dan.j.williams@intel.com>
-rw-r--r--drivers/dma/amba-pl08x.c5
1 files changed, 3 insertions, 2 deletions
diff --git a/drivers/dma/amba-pl08x.c b/drivers/dma/amba-pl08x.c
index 69cfb05e4d3c..b3b3180ce561 100644
--- a/drivers/dma/amba-pl08x.c
+++ b/drivers/dma/amba-pl08x.c
@@ -1332,9 +1332,10 @@ static int pl08x_prep_channel_resources(struct pl08x_dma_chan *plchan,
1332 int ret; 1332 int ret;
1333 1333
1334 num_llis = pl08x_fill_llis_for_desc(pl08x, txd); 1334 num_llis = pl08x_fill_llis_for_desc(pl08x, txd);
1335 1335 if (!num_llis) {
1336 if (!num_llis) 1336 kfree(txd);
1337 return -EINVAL; 1337 return -EINVAL;
1338 }
1338 1339
1339 spin_lock_irqsave(&plchan->lock, plchan->lockflags); 1340 spin_lock_irqsave(&plchan->lock, plchan->lockflags);
1340 1341