summaryrefslogtreecommitdiff
path: root/drivers/crypto/caam/caamhash.c
diff options
context:
space:
mode:
authorAymen Sghaier <aymen.sghaier@nxp.com>2018-06-04 11:21:28 +0200
committerJason Liu <jason.hui.liu@nxp.com>2019-02-12 10:32:47 +0800
commitb40c781ec98391ce0dae037e233b393e4cee2d9f (patch)
tree4f51ea08a3d568ab36dbca61b17c06b8437b0b68 /drivers/crypto/caam/caamhash.c
parent2a5d91de867b1b67a9097e8cf067c29381d901b9 (diff)
MLK-17304: crypto: caam: Fix error swiotlb buffer is full for caamhash
During caamhash tests the error "swiotlb buffer is full" occurred. This was due to dma mapping without unmapping later. This patch adds the unmap call to avoid the loss of dma memory. Signed-off-by: Aymen Sghaier <aymen.sghaier@nxp.com> Signed-off-by: Franck LENORMAND <franck.lenormand@nxp.com>
Diffstat (limited to 'drivers/crypto/caam/caamhash.c')
-rw-r--r--drivers/crypto/caam/caamhash.c8
1 files changed, 8 insertions, 0 deletions
diff --git a/drivers/crypto/caam/caamhash.c b/drivers/crypto/caam/caamhash.c
index cef0ce4d2598..6e873496fa30 100644
--- a/drivers/crypto/caam/caamhash.c
+++ b/drivers/crypto/caam/caamhash.c
@@ -707,6 +707,14 @@ static inline void ahash_unmap(struct device *dev,
if (edesc->dst_dma)
dma_unmap_single(dev, edesc->dst_dma, dst_len, DMA_FROM_DEVICE);
+ if (state->buf_dma) {
+ dma_unmap_single(dev, state->buf_dma,
+ (state->current_buf ?
+ state->buflen_1 : state->buflen_0),
+ DMA_TO_DEVICE);
+ state->buf_dma = 0;
+ }
+
if (edesc->sec4_sg_bytes)
dma_unmap_single(dev, edesc->sec4_sg_dma,
edesc->sec4_sg_bytes, DMA_TO_DEVICE);