[<prev] [next>] [<thread-prev] [day] [month] [year] [list]
Message-ID: <e9c3a7c21002282114w3de2806eoe2ecc8e0f9207d00@mail.gmail.com>
Date: Sun, 28 Feb 2010 22:14:27 -0700
From: Dan Williams <dan.j.williams@...el.com>
To: "Steven J. Magnani" <steve@...idescorp.com>
Cc: Li Yang <leoli@...escale.com>, Zhang Wei <zw@...kernel.org>,
linuxppc-dev@...abs.org, linux-kernel@...r.kernel.org,
"Ira W. Snyder" <iws@...o.caltech.edu>
Subject: Re: [async_tx-next PATCH v2 2/2] fsldma: Fix cookie issues
On Thu, Feb 25, 2010 at 12:39 PM, Steven J. Magnani
<steve@...idescorp.com> wrote:
> fsl_dma_update_completed_cookie() appears to calculate the last completed
> cookie incorrectly in the corner case where DMA on cookie 1 is in progress
> just following a cookie wrap.
>
> Signed-off-by: Steven J. Magnani <steve@...idescorp.com>
> ---
> diff -uprN a/drivers/dma/fsldma.c b/drivers/dma/fsldma.c
> --- a/drivers/dma/fsldma.c 2010-02-22 11:16:36.000000000 -0600
> +++ b/drivers/dma/fsldma.c 2010-02-22 11:08:41.000000000 -0600
> @@ -819,8 +819,11 @@ static void fsl_dma_update_completed_coo
> desc = to_fsl_desc(chan->ld_running.prev);
> if (dma_is_idle(chan))
> cookie = desc->async_tx.cookie;
> - else
> + else {
> cookie = desc->async_tx.cookie - 1;
> + if (unlikely(cookie < DMA_MIN_COOKIE))
> + cookie = DMA_MAX_COOKIE;
> + }
>
> chan->completed_cookie = cookie;
>
> diff -uprN a/include/linux/dmaengine.h b/include/linux/dmaengine.h
> --- a/include/linux/dmaengine.h 2010-02-22 11:18:11.000000000 -0600
> +++ b/include/linux/dmaengine.h 2010-02-22 11:18:30.000000000 -0600
> @@ -31,6 +31,8 @@
> * if dma_cookie_t is >0 it's a DMA request cookie, <0 it's an error code
> */
> typedef s32 dma_cookie_t;
> +#define DMA_MIN_COOKIE 1
> +#define DMA_MAX_COOKIE ((1 << 31) - 1)
>
This patch introduces a new warning::
drivers/dma/fsldma.c:825: warning: integer overflow in expression
I'll fix this up to use INT_MAX instead.
--
Dan
powerpc-linux-gnu-gcc --version
powerpc-linux-gnu-gcc (Sourcery G++ Lite 4.2-50) 4.2.1
--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@...r.kernel.org
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/
Powered by blists - more mailing lists