From: Dan Carpenter <error27@gmail.com>
To: Dan Williams <dan.j.williams@intel.com>
Cc: "Linus Walleij" <linus.walleij@stericsson.com>,
"Mark Brown" <broonie@opensource.wolfsonmicro.com>,
"Richard Röjfors" <richard.rojfors@pelagicore.com>,
"Stephen Rothwell" <sfr@canb.auug.org.au>,
linux-kernel@vger.kernel.org, kernel-janitors@vger.kernel.org
Subject: [patch 1/2] dma/timb_dma: fixup error handling in
Date: Tue, 25 May 2010 09:53:48 +0000 [thread overview]
Message-ID: <20100525095348.GI22515@bicker> (raw)
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;
}
reply other threads:[~2010-05-25 9:53 UTC|newest]
Thread overview: [no followups] expand[flat|nested] mbox.gz Atom feed
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20100525095348.GI22515@bicker \
--to=error27@gmail.com \
--cc=broonie@opensource.wolfsonmicro.com \
--cc=dan.j.williams@intel.com \
--cc=kernel-janitors@vger.kernel.org \
--cc=linus.walleij@stericsson.com \
--cc=linux-kernel@vger.kernel.org \
--cc=richard.rojfors@pelagicore.com \
--cc=sfr@canb.auug.org.au \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox