]> git.baikalelectronics.ru Git - kernel.git/commitdiff
crypto: sun8i-ss - Fix error codes for dma_mapping_error()
authorDan Carpenter <dan.carpenter@oracle.com>
Wed, 18 May 2022 17:33:54 +0000 (20:33 +0300)
committerHerbert Xu <herbert@gondor.apana.org.au>
Fri, 10 Jun 2022 08:40:16 +0000 (16:40 +0800)
If there is a dma_mapping_error() then return negative error codes.
Currently this code returns success.

Fixes: 756dbd1a759d ("crypto: sun8i-ss - add hmac(sha1)")
Signed-off-by: Dan Carpenter <dan.carpenter@oracle.com>
Acked-by: Corentin Labbe <clabbe.montjoie@gmail.com>
Tested-by: Corentin Labbe <clabbe.montjoie@gmail.com>
Signed-off-by: Herbert Xu <herbert@gondor.apana.org.au>
drivers/crypto/allwinner/sun8i-ss/sun8i-ss-hash.c

index ac417a6b39e5fd2912e38dbb1f573e25ff5e0a36..845019bd95911dfeb8fa9ade7cc3c88b16921d0f 100644 (file)
@@ -586,7 +586,8 @@ retry:
                        rctx->t_dst[k + 1].len = rctx->t_dst[k].len;
                }
                addr_xpad = dma_map_single(ss->dev, tfmctx->ipad, bs, DMA_TO_DEVICE);
-               if (dma_mapping_error(ss->dev, addr_xpad)) {
+               err = dma_mapping_error(ss->dev, addr_xpad);
+               if (err) {
                        dev_err(ss->dev, "Fail to create DMA mapping of ipad\n");
                        goto err_dma_xpad;
                }
@@ -612,7 +613,8 @@ retry:
                        goto err_dma_result;
                }
                addr_xpad = dma_map_single(ss->dev, tfmctx->opad, bs, DMA_TO_DEVICE);
-               if (dma_mapping_error(ss->dev, addr_xpad)) {
+               err = dma_mapping_error(ss->dev, addr_xpad);
+               if (err) {
                        dev_err(ss->dev, "Fail to create DMA mapping of opad\n");
                        goto err_dma_xpad;
                }