Commit 6cb3f9b2 authored by Dan Carpenter's avatar Dan Carpenter Committed by Herbert Xu

crypto: sun8i-ss - Fix error codes for dma_mapping_error()

If there is a dma_mapping_error() then return negative error codes.
Currently this code returns success.

Fixes: 801b7d57 ("crypto: sun8i-ss - add hmac(sha1)")
Signed-off-by: default avatarDan Carpenter <dan.carpenter@oracle.com>
Acked-by: default avatarCorentin Labbe <clabbe.montjoie@gmail.com>
Tested-by: default avatarCorentin Labbe <clabbe.montjoie@gmail.com>
Signed-off-by: default avatarHerbert Xu <herbert@gondor.apana.org.au>
parent d2765e1b
...@@ -586,7 +586,8 @@ int sun8i_ss_hash_run(struct crypto_engine *engine, void *breq) ...@@ -586,7 +586,8 @@ int sun8i_ss_hash_run(struct crypto_engine *engine, void *breq)
rctx->t_dst[k + 1].len = rctx->t_dst[k].len; rctx->t_dst[k + 1].len = rctx->t_dst[k].len;
} }
addr_xpad = dma_map_single(ss->dev, tfmctx->ipad, bs, DMA_TO_DEVICE); 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"); dev_err(ss->dev, "Fail to create DMA mapping of ipad\n");
goto err_dma_xpad; goto err_dma_xpad;
} }
...@@ -612,7 +613,8 @@ int sun8i_ss_hash_run(struct crypto_engine *engine, void *breq) ...@@ -612,7 +613,8 @@ int sun8i_ss_hash_run(struct crypto_engine *engine, void *breq)
goto err_dma_result; goto err_dma_result;
} }
addr_xpad = dma_map_single(ss->dev, tfmctx->opad, bs, DMA_TO_DEVICE); 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"); dev_err(ss->dev, "Fail to create DMA mapping of opad\n");
goto err_dma_xpad; goto err_dma_xpad;
} }
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment