diff options
author | Jack Wang <jinpu.wang@ionos.com> | 2022-08-19 08:07:50 +0200 |
---|---|---|
committer | Herbert Xu <herbert@gondor.apana.org.au> | 2022-08-26 18:50:39 +0800 |
commit | 66f0b6b7d839b49e19a856a90b70656dccc4b844 (patch) | |
tree | f3f9ee53da2805405695d6974b16e72d14d47b43 /drivers/crypto/sahara.c | |
parent | 545665ad1e84eb8f047018a2f607e78cef29c7fa (diff) | |
download | linux-66f0b6b7d839b49e19a856a90b70656dccc4b844.tar.gz linux-66f0b6b7d839b49e19a856a90b70656dccc4b844.tar.bz2 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 'drivers/crypto/sahara.c')
-rw-r--r-- | drivers/crypto/sahara.c | 4 |
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; } |