All of lore.kernel.org
 help / color / mirror / Atom feed
From: "Shimoda, Yoshihiro" <yoshihiro.shimoda.uh@renesas.com>
To: Paul Mundt <lethal-M7jkjyW5wf5g9hUCZPvPmw@public.gmane.org>
Cc: spi-devel-general-5NWGOfrQmneRv+LV9MX5uipxlwaOVQ5f@public.gmane.org,
	SH-Linux <linux-sh-u79uwXL29TY76Z2rM5mHXA@public.gmane.org>
Subject: Re: [PATCH] spi: spi-rspi: add dmaengine supporting
Date: Fri, 20 Apr 2012 04:14:09 +0000	[thread overview]
Message-ID: <4F90E291.6020302@renesas.com> (raw)
In-Reply-To: <20120420013610.GE22189-M7jkjyW5wf5g9hUCZPvPmw@public.gmane.org>

2012/04/20 10:36, Paul Mundt wrote:
> 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.
> 

Thank you for the point. I will fix this.

Best regards,
Yoshihiro Shimoda

WARNING: multiple messages have this Message-ID (diff)
From: "Shimoda, Yoshihiro" <yoshihiro.shimoda.uh-zM6kxYcvzFBBDgjK7y7TUQ@public.gmane.org>
To: Paul Mundt <lethal-M7jkjyW5wf5g9hUCZPvPmw@public.gmane.org>
Cc: spi-devel-general-5NWGOfrQmneRv+LV9MX5uipxlwaOVQ5f@public.gmane.org,
	SH-Linux <linux-sh-u79uwXL29TY76Z2rM5mHXA@public.gmane.org>
Subject: Re: [PATCH] spi: spi-rspi: add dmaengine supporting
Date: Fri, 20 Apr 2012 13:14:09 +0900	[thread overview]
Message-ID: <4F90E291.6020302@renesas.com> (raw)
In-Reply-To: <20120420013610.GE22189-M7jkjyW5wf5g9hUCZPvPmw@public.gmane.org>

2012/04/20 10:36, Paul Mundt wrote:
> 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.
> 

Thank you for the point. I will fix this.

Best regards,
Yoshihiro Shimoda

------------------------------------------------------------------------------
For Developers, A Lot Can Happen In A Second.
Boundary is the first to Know...and Tell You.
Monitor Your Applications in Ultra-Fine Resolution. Try it FREE!
http://p.sf.net/sfu/Boundary-d2dvs2

  parent reply	other threads:[~2012-04-20  4:14 UTC|newest]

Thread overview: 6+ 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-19 10:22 ` Shimoda, Yoshihiro
2012-04-20  1:36 ` Paul Mundt
2012-04-20  1:36   ` Paul Mundt
     [not found]   ` <20120420013610.GE22189-M7jkjyW5wf5g9hUCZPvPmw@public.gmane.org>
2012-04-20  4:14     ` Shimoda, Yoshihiro [this message]
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=4F90E291.6020302@renesas.com \
    --to=yoshihiro.shimoda.uh@renesas.com \
    --cc=lethal-M7jkjyW5wf5g9hUCZPvPmw@public.gmane.org \
    --cc=linux-sh-u79uwXL29TY76Z2rM5mHXA@public.gmane.org \
    --cc=spi-devel-general-5NWGOfrQmneRv+LV9MX5uipxlwaOVQ5f@public.gmane.org \
    /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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.