From: Paul Mundt <lethal@linux-sh.org>
To: "Shimoda, Yoshihiro" <yoshihiro.shimoda.uh@renesas.com>
Cc: Grant Likely <grant.likely@secretlab.ca>,
spi-devel-general@lists.sourceforge.net,
SH-Linux <linux-sh@vger.kernel.org>
Subject: Re: [PATCH] spi: spi-rspi: add dmaengine supporting
Date: Fri, 20 Apr 2012 10:36:11 +0900 [thread overview]
Message-ID: <20120420013610.GE22189@linux-sh.org> (raw)
In-Reply-To: <4F8FE77D.7020000@renesas.com>
On Thu, Apr 19, 2012 at 07:22:53PM +0900, Shimoda, Yoshihiro wrote:
> +static struct dma_async_tx_descriptor *rspi_dma_prep_sg(struct scatterlist *sg,
> + void *buf, unsigned len, struct dma_chan *chan,
> + enum dma_transfer_direction dir)
> +{
> + sg_init_table(sg, 1);
> + sg_set_buf(sg, buf, len);
> + sg_dma_len(sg) = len,
> + dma_map_sg(chan->device->dev, sg, 1, dir);
> + return dmaengine_prep_slave_sg(chan, sg, 1, dir,
> + DMA_PREP_INTERRUPT | DMA_CTRL_ACK);
> +}
> +
..
> + desc = rspi_dma_prep_sg(&sg, buf, len, rspi->chan_tx, DMA_TO_DEVICE);
> + if (!desc) {
> + ret = -EIO;
> + goto error;
> + }
> +
..
> +error:
> + if (rspi->dma_width_16bit)
> + kfree(buf);
> +
> + return ret;
> +}
> +
The sg list handling is unbalanced. Specifically you always map the
scatterlist with dma_map_sg() but you have no corresponding
dma_unmap_sg() anywhere, either in the error path or your regular exit
path.
next prev parent reply other threads:[~2012-04-20 1:36 UTC|newest]
Thread overview: 3+ messages / expand[flat|nested] mbox.gz Atom feed top
2012-04-19 10:22 [PATCH] spi: spi-rspi: add dmaengine supporting Shimoda, Yoshihiro
2012-04-20 1:36 ` Paul Mundt [this message]
[not found] ` <20120420013610.GE22189-M7jkjyW5wf5g9hUCZPvPmw@public.gmane.org>
2012-04-20 4:14 ` Shimoda, Yoshihiro
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=20120420013610.GE22189@linux-sh.org \
--to=lethal@linux-sh.org \
--cc=grant.likely@secretlab.ca \
--cc=linux-sh@vger.kernel.org \
--cc=spi-devel-general@lists.sourceforge.net \
--cc=yoshihiro.shimoda.uh@renesas.com \
/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;
as well as URLs for NNTP newsgroup(s).