summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorZhang Jiejing <jiejing.zhang@freescale.com>2012-09-12 18:04:49 +0800
committerEric Nelson <eric.nelson@boundarydevices.com>2013-07-05 13:01:24 -0700
commit10ab984e3cf02a14d00c213faff1d4f4c4433f37 (patch)
treec51e5cfa8e743402d5c113c0caefafcd162e235d
parent1b8293207298116d842d09653c9de73964564870 (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);