aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--drivers/dma/fsldma.c5
-rw-r--r--include/linux/dmaengine.h2
2 files changed, 6 insertions, 1 deletions
diff --git a/drivers/dma/fsldma.c b/drivers/dma/fsldma.c
index 6541ebf8bf63..bbb4be5a3ff4 100644
--- a/drivers/dma/fsldma.c
+++ b/drivers/dma/fsldma.c
@@ -819,8 +819,11 @@ static void fsl_dma_update_completed_cookie(struct fsldma_chan *chan)
819 desc = to_fsl_desc(chan->ld_running.prev); 819 desc = to_fsl_desc(chan->ld_running.prev);
820 if (dma_is_idle(chan)) 820 if (dma_is_idle(chan))
821 cookie = desc->async_tx.cookie; 821 cookie = desc->async_tx.cookie;
822 else 822 else {
823 cookie = desc->async_tx.cookie - 1; 823 cookie = desc->async_tx.cookie - 1;
824 if (unlikely(cookie < DMA_MIN_COOKIE))
825 cookie = DMA_MAX_COOKIE;
826 }
824 827
825 chan->completed_cookie = cookie; 828 chan->completed_cookie = cookie;
826 829
diff --git a/include/linux/dmaengine.h b/include/linux/dmaengine.h
index 78784982b33e..4d8d619f28bc 100644
--- a/include/linux/dmaengine.h
+++ b/include/linux/dmaengine.h
@@ -31,6 +31,8 @@
31 * if dma_cookie_t is >0 it's a DMA request cookie, <0 it's an error code 31 * if dma_cookie_t is >0 it's a DMA request cookie, <0 it's an error code
32 */ 32 */
33typedef s32 dma_cookie_t; 33typedef s32 dma_cookie_t;
34#define DMA_MIN_COOKIE 1
35#define DMA_MAX_COOKIE INT_MAX
34 36
35#define dma_submit_error(cookie) ((cookie) < 0 ? 1 : 0) 37#define dma_submit_error(cookie) ((cookie) < 0 ? 1 : 0)
36 38