]> git.proxmox.com Git - mirror_ubuntu-jammy-kernel.git/commitdiff
crypto: amlogic - Fix the parameter of dma_unmap_sg()
authorXiang Chen <chenxiang66@hisilicon.com>
Tue, 16 Mar 2021 01:55:23 +0000 (09:55 +0800)
committerHerbert Xu <herbert@gondor.apana.org.au>
Fri, 26 Mar 2021 09:02:34 +0000 (20:02 +1100)
For function dma_unmap_sg(), the <nents> parameter should be number of
elements in the scatterlist prior to the mapping, not after the mapping.
So fix this usage.

Signed-off-by: Xiang Chen <chenxiang66@hisilicon.com>
Signed-off-by: Herbert Xu <herbert@gondor.apana.org.au>
drivers/crypto/amlogic/amlogic-gxl-cipher.c

index 8b5e07316352c3df6ac52ea27bebd11c0897fe72..c6865cbd334b293bec18184dc128bc2863d7546f 100644 (file)
@@ -236,10 +236,10 @@ static int meson_cipher(struct skcipher_request *areq)
        dma_unmap_single(mc->dev, phykeyiv, keyivlen, DMA_TO_DEVICE);
 
        if (areq->src == areq->dst) {
-               dma_unmap_sg(mc->dev, areq->src, nr_sgs, DMA_BIDIRECTIONAL);
+               dma_unmap_sg(mc->dev, areq->src, sg_nents(areq->src), DMA_BIDIRECTIONAL);
        } else {
-               dma_unmap_sg(mc->dev, areq->src, nr_sgs, DMA_TO_DEVICE);
-               dma_unmap_sg(mc->dev, areq->dst, nr_sgd, DMA_FROM_DEVICE);
+               dma_unmap_sg(mc->dev, areq->src, sg_nents(areq->src), DMA_TO_DEVICE);
+               dma_unmap_sg(mc->dev, areq->dst, sg_nents(areq->dst), DMA_FROM_DEVICE);
        }
 
        if (areq->iv && ivsize > 0) {