Merge git://git.kernel.org/pub/scm/linux/kernel/git/herbert/crypto-2.6
[pandora-kernel.git] / drivers / dma / fsldma.c
index 92efa87..bbb4be5 100644 (file)
@@ -362,7 +362,7 @@ static dma_cookie_t fsl_dma_tx_submit(struct dma_async_tx_descriptor *tx)
                if (cookie < 0)
                        cookie = 1;
 
-               desc->async_tx.cookie = cookie;
+               child->async_tx.cookie = cookie;
        }
 
        chan->common.cookie = cookie;
@@ -819,8 +819,11 @@ static void fsl_dma_update_completed_cookie(struct fsldma_chan *chan)
        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;