[<prev] [next>] [day] [month] [year] [list]
Message-ID: <20100525095348.GI22515@bicker>
Date: Tue, 25 May 2010 11:53:48 +0200
From: Dan Carpenter <error27@...il.com>
To: Dan Williams <dan.j.williams@...el.com>
Cc: Linus Walleij <linus.walleij@...ricsson.com>,
Mark Brown <broonie@...nsource.wolfsonmicro.com>,
Richard Röjfors
<richard.rojfors@...agicore.com>,
Stephen Rothwell <sfr@...b.auug.org.au>,
linux-kernel@...r.kernel.org, kernel-janitors@...r.kernel.org
Subject: [patch 1/2] dma/timb_dma: fixup error handling in
td_alloc_init_desc()
The original code tried to kfree(td_desc->desc_list) when td_desc was
NULL so I re-arranged it.
Signed-off-by: Dan Carpenter <error27@...il.com>
diff --git a/drivers/dma/timb_dma.c b/drivers/dma/timb_dma.c
index 0172fa3..3e101a0 100644
--- a/drivers/dma/timb_dma.c
+++ b/drivers/dma/timb_dma.c
@@ -390,7 +390,7 @@ static struct timb_dma_desc *td_alloc_init_desc(struct timb_dma_chan *td_chan)
td_desc->desc_list = kzalloc(td_desc->desc_list_len, GFP_KERNEL);
if (!td_desc->desc_list) {
dev_err(chan2dev(chan), "Failed to alloc descriptor\n");
- goto err;
+ goto err_desc;
}
dma_async_tx_descriptor_init(&td_desc->txd, chan);
@@ -403,14 +403,16 @@ static struct timb_dma_desc *td_alloc_init_desc(struct timb_dma_chan *td_chan)
err = dma_mapping_error(chan2dmadev(chan), td_desc->txd.phys);
if (err) {
dev_err(chan2dev(chan), "DMA mapping error: %d\n", err);
- goto err;
+ goto err_list;
}
return td_desc;
-err:
+
+err_list:
kfree(td_desc->desc_list);
+err_desc:
kfree(td_desc);
-
+err:
return NULL;
}
--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@...r.kernel.org
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/
Powered by blists - more mailing lists