crypto: ccree - Fix dma_map_sg error check
authorJack Wang <jinpu.wang@ionos.com>
Fri, 19 Aug 2022 06:07:54 +0000 (08:07 +0200)
committerHerbert Xu <herbert@gondor.apana.org.au>
Fri, 26 Aug 2022 10:50:40 +0000 (18:50 +0800)
dma_map_sg return 0 on error, and dma_map_error is not supposed to use
here.

Cc: Gilad Ben-Yossef <gilad@benyossef.com>
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: Gilad Ben-Yossef <gilad@benyossef.com>
Signed-off-by: Herbert Xu <herbert@gondor.apana.org.au>
drivers/crypto/ccree/cc_buffer_mgr.c

index 6140e492732265b0af70b6b00c53c6dd7e82d774..9efd88f871d1232fdc5708c312de012347175152 100644 (file)
@@ -274,7 +274,7 @@ static int cc_map_sg(struct device *dev, struct scatterlist *sg,
        }
 
        ret = dma_map_sg(dev, sg, *nents, direction);
-       if (dma_mapping_error(dev, ret)) {
+       if (!ret) {
                *nents = 0;
                dev_err(dev, "dma_map_sg() sg buffer failed %d\n", ret);
                return -ENOMEM;