diff mbox

dmaengine: zxdma: Fix off-by-one for testing valid pchan request

Message ID 1443258947.5483.1.camel@ingics.com (mailing list archive)
State Accepted
Headers show

Commit Message

Axel Lin Sept. 26, 2015, 9:15 a.m. UTC
The valid pchan range is 0 ~ d->dma_requests - 1.

Signed-off-by: Axel Lin <axel.lin@ingics.com>
---
 drivers/dma/zx296702_dma.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

Comments

Jun Nie Sept. 30, 2015, 12:57 a.m. UTC | #1
2015-09-26 17:15 GMT+08:00 Axel Lin <axel.lin@ingics.com>:
> The valid pchan range is 0 ~ d->dma_requests - 1.
>
> Signed-off-by: Axel Lin <axel.lin@ingics.com>
> ---
>  drivers/dma/zx296702_dma.c | 2 +-
>  1 file changed, 1 insertion(+), 1 deletion(-)
>
> diff --git a/drivers/dma/zx296702_dma.c b/drivers/dma/zx296702_dma.c
> index 39915a6..c017fcd 100644
> --- a/drivers/dma/zx296702_dma.c
> +++ b/drivers/dma/zx296702_dma.c
> @@ -739,7 +739,7 @@ static struct dma_chan *zx_of_dma_simple_xlate(struct of_phandle_args *dma_spec,
>         struct dma_chan *chan;
>         struct zx_dma_chan *c;
>
> -       if (request > d->dma_requests)
> +       if (request >= d->dma_requests)
>                 return NULL;
>
>         chan = dma_get_any_slave_channel(&d->slave);
> --
> 2.1.4
>
>
>

Reviewed-by: Jun Nie <jun.nie@linaro.org>
--
To unsubscribe from this list: send the line "unsubscribe dmaengine" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Vinod Koul Oct. 1, 2015, 2:12 a.m. UTC | #2
On Sat, Sep 26, 2015 at 05:15:47PM +0800, Axel Lin wrote:
> The valid pchan range is 0 ~ d->dma_requests - 1.
> 
Applied, thanks
diff mbox

Patch

diff --git a/drivers/dma/zx296702_dma.c b/drivers/dma/zx296702_dma.c
index 39915a6..c017fcd 100644
--- a/drivers/dma/zx296702_dma.c
+++ b/drivers/dma/zx296702_dma.c
@@ -739,7 +739,7 @@  static struct dma_chan *zx_of_dma_simple_xlate(struct of_phandle_args *dma_spec,
 	struct dma_chan *chan;
 	struct zx_dma_chan *c;
 
-	if (request > d->dma_requests)
+	if (request >= d->dma_requests)
 		return NULL;
 
 	chan = dma_get_any_slave_channel(&d->slave);