public inbox for kernel-janitors@vger.kernel.org
 help / color / mirror / Atom feed
* [patch 1/2] dma/timb_dma: fixup error handling in
@ 2010-05-25  9:53 Dan Carpenter
  0 siblings, 0 replies; only message in thread
From: Dan Carpenter @ 2010-05-25  9:53 UTC (permalink / raw)
  To: Dan Williams
  Cc: Linus Walleij, Mark Brown, Richard Röjfors, Stephen Rothwell,
	linux-kernel, kernel-janitors

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@gmail.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;
 
 }

^ permalink raw reply related	[flat|nested] only message in thread

only message in thread, other threads:[~2010-05-25  9:53 UTC | newest]

Thread overview: (only message) (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2010-05-25  9:53 [patch 1/2] dma/timb_dma: fixup error handling in Dan Carpenter

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox