forked from Minki/linux
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>
This commit is contained in:
parent
545665ad1e
commit
66f0b6b7d8
@ -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;
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user