diff options
-rw-r--r-- | crypto/async_tx/async_tx.c | 12 |
1 files changed, 10 insertions, 2 deletions
diff --git a/crypto/async_tx/async_tx.c b/crypto/async_tx/async_tx.c index 035007145e78..bc18cbb8ea79 100644 --- a/crypto/async_tx/async_tx.c +++ b/crypto/async_tx/async_tx.c | |||
@@ -80,6 +80,7 @@ dma_wait_for_async_tx(struct dma_async_tx_descriptor *tx) | |||
80 | { | 80 | { |
81 | enum dma_status status; | 81 | enum dma_status status; |
82 | struct dma_async_tx_descriptor *iter; | 82 | struct dma_async_tx_descriptor *iter; |
83 | struct dma_async_tx_descriptor *parent; | ||
83 | 84 | ||
84 | if (!tx) | 85 | if (!tx) |
85 | return DMA_SUCCESS; | 86 | return DMA_SUCCESS; |
@@ -87,8 +88,15 @@ dma_wait_for_async_tx(struct dma_async_tx_descriptor *tx) | |||
87 | /* poll through the dependency chain, return when tx is complete */ | 88 | /* poll through the dependency chain, return when tx is complete */ |
88 | do { | 89 | do { |
89 | iter = tx; | 90 | iter = tx; |
90 | while (iter->cookie == -EBUSY) | 91 | |
91 | iter = iter->parent; | 92 | /* find the root of the unsubmitted dependency chain */ |
93 | while (iter->cookie == -EBUSY) { | ||
94 | parent = iter->parent; | ||
95 | if (parent && parent->cookie == -EBUSY) | ||
96 | iter = iter->parent; | ||
97 | else | ||
98 | break; | ||
99 | } | ||
92 | 100 | ||
93 | status = dma_sync_wait(iter->chan, iter->cookie); | 101 | status = dma_sync_wait(iter->chan, iter->cookie); |
94 | } while (status == DMA_IN_PROGRESS || (iter != tx)); | 102 | } while (status == DMA_IN_PROGRESS || (iter != tx)); |