summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorZhang Jiejing <jiejing.zhang@freescale.com>2012-09-12 18:04:49 +0800
committerJason Liu <r64343@freescale.com>2013-06-17 10:16:45 +0800
commitb30237c79003223c6e8035d5be183cd4f0b469f9 (patch)
tree35279445f8c3336517d0780635c06d2ac7a07b00
parentf030c69b8283821234e419dfaa5843c55dafa0a7 (diff)
ENGR00240112-1 caam: fix user space crypto API support.
This patch fix the CAAM support for Crypto User Space API support. in the dma_map_sg_chained() function, the chained mode will loop until the scatter list end, but when the scatter list end, it will return null and orignal code will set this to the sg list point used by dma_sync, so it will panic. When do chain dma, use a tmp do going through the list. Signed-off-by Zhang Jiejing <jiejing.zhang@freescale.com>
-rw-r--r--drivers/crypto/caam/sg_sw_sec4.h10
1 files changed, 7 insertions, 3 deletions
diff --git a/drivers/crypto/caam/sg_sw_sec4.h b/drivers/crypto/caam/sg_sw_sec4.h
index e05fc58c9637..f3f5187a14c3 100644
--- a/drivers/crypto/caam/sg_sw_sec4.h
+++ b/drivers/crypto/caam/sg_sw_sec4.h
@@ -1,7 +1,7 @@
/*
* CAAM/SEC 4.x functions for using scatterlists in caam driver
*
- * Copyright (C) 2008-2012 Freescale Semiconductor, Inc.
+ * Copyright (C) 2008-2013 Freescale Semiconductor, Inc.
*
*/
@@ -93,9 +93,13 @@ static int dma_map_sg_chained(struct device *dev, struct scatterlist *sg,
{
if (unlikely(chained)) {
int i;
+ struct scatterlist *tsg = sg;
+ /* Needs a temp copy for sg pointer, otherwise
+ * scatterwalke_sg_next will return null when list is
+ * ended */
for (i = 0; i < nents; i++) {
- dma_map_sg(dev, sg, 1, dir);
- sg = scatterwalk_sg_next(sg);
+ dma_map_sg(dev, tsg, 1, dir);
+ tsg = scatterwalk_sg_next(tsg);
}
} else {
dma_map_sg(dev, sg, nents, dir);