Do DMA unmap on ->device_prep_dma_memset failure.

Cc: Dan Williams <[email protected]>
Cc: Tomasz Figa <[email protected]>
Signed-off-by: Bartlomiej Zolnierkiewicz <[email protected]>
Signed-off-by: Kyungmin Park <[email protected]>
---
 crypto/async_tx/async_memset.c | 3 +++
 1 file changed, 3 insertions(+)

diff --git a/crypto/async_tx/async_memset.c b/crypto/async_tx/async_memset.c
index 05a4d1e..a6a667b 100644
--- a/crypto/async_tx/async_memset.c
+++ b/crypto/async_tx/async_memset.c
@@ -61,6 +61,9 @@ async_memset(struct page *dest, int val, unsigned int offset, 
size_t len,
 
                tx = device->device_prep_dma_memset(chan, dma_dest, val, len,
                                                    dma_prep_flags);
+               if (!tx)
+                       dma_unmap_page(device->dev, dma_dest, len,
+                                      DMA_FROM_DEVICE);
        }
 
        if (tx) {
-- 
1.8.0

--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to [email protected]
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/

Reply via email to