summaryrefslogtreecommitdiffstats
path: root/drivers/crypto/sahara.c
diff options
context:
space:
mode:
authorJack Wang <jinpu.wang@ionos.com>2022-08-19 08:07:50 +0200
committerHerbert Xu <herbert@gondor.apana.org.au>2022-08-26 12:50:39 +0200
commit66f0b6b7d839b49e19a856a90b70656dccc4b844 (patch)
treef3f9ee53da2805405695d6974b16e72d14d47b43 /drivers/crypto/sahara.c
parentcrypto: gemini - Fix error check for dma_map_sg (diff)
downloadlinux-66f0b6b7d839b49e19a856a90b70656dccc4b844.tar.xz
linux-66f0b6b7d839b49e19a856a90b70656dccc4b844.zip
crypto: sahara - Fix error check for dma_map_sg
dma_map_sg return 0 on error, it returns the number of DMA address segments mapped (this may be shorter than <nents> passed in if some elements of the scatter/gather list are physically or virtually adjacent and an IOMMU maps them with a single entry). Cc: Herbert Xu <herbert@gondor.apana.org.au> Cc: "David S. Miller" <davem@davemloft.net> Cc: linux-crypto@vger.kernel.org Cc: linux-kernel@vger.kernel.org Signed-off-by: Jack Wang <jinpu.wang@ionos.com> Signed-off-by: Herbert Xu <herbert@gondor.apana.org.au>
Diffstat (limited to '')
-rw-r--r--drivers/crypto/sahara.c4
1 files changed, 2 insertions, 2 deletions
diff --git a/drivers/crypto/sahara.c b/drivers/crypto/sahara.c
index b07ae4ba165e..7ab20fb95166 100644
--- a/drivers/crypto/sahara.c
+++ b/drivers/crypto/sahara.c
@@ -487,13 +487,13 @@ static int sahara_hw_descriptor_create(struct sahara_dev *dev)
ret = dma_map_sg(dev->device, dev->in_sg, dev->nb_in_sg,
DMA_TO_DEVICE);
- if (ret != dev->nb_in_sg) {
+ if (!ret) {
dev_err(dev->device, "couldn't map in sg\n");
goto unmap_in;
}
ret = dma_map_sg(dev->device, dev->out_sg, dev->nb_out_sg,
DMA_FROM_DEVICE);
- if (ret != dev->nb_out_sg) {
+ if (!ret) {
dev_err(dev->device, "couldn't map out sg\n");
goto unmap_out;
}