Commit f2339eb9 authored by Dan Carpenter's avatar Dan Carpenter Committed by Herbert Xu

crypto: cavium/nitrox - dma_mapping_error() returns bool

We want to return negative error codes here, but we're accidentally
propogating the "true" return from dma_mapping_error().

Fixes: 14fa93cd ("crypto: cavium - Add support for CNN55XX adapters.")
Signed-off-by: default avatarDan Carpenter <dan.carpenter@oracle.com>
Signed-off-by: default avatarHerbert Xu <herbert@gondor.apana.org.au>
parent 8bd1d400
...@@ -199,9 +199,10 @@ static int dma_map_inbufs(struct nitrox_softreq *sr, ...@@ -199,9 +199,10 @@ static int dma_map_inbufs(struct nitrox_softreq *sr,
sr->in.sglist = glist; sr->in.sglist = glist;
/* map IV */ /* map IV */
dma = dma_map_single(dev, &req->iv, req->ivsize, DMA_BIDIRECTIONAL); dma = dma_map_single(dev, &req->iv, req->ivsize, DMA_BIDIRECTIONAL);
ret = dma_mapping_error(dev, dma); if (dma_mapping_error(dev, dma)) {
if (ret) ret = -EINVAL;
goto iv_map_err; goto iv_map_err;
}
sr->in.dir = (req->src == req->dst) ? DMA_BIDIRECTIONAL : DMA_TO_DEVICE; sr->in.dir = (req->src == req->dst) ? DMA_BIDIRECTIONAL : DMA_TO_DEVICE;
/* map src entries */ /* map src entries */
...@@ -268,16 +269,18 @@ static int dma_map_outbufs(struct nitrox_softreq *sr, ...@@ -268,16 +269,18 @@ static int dma_map_outbufs(struct nitrox_softreq *sr,
/* map ORH */ /* map ORH */
sr->resp.orh_dma = dma_map_single(dev, &sr->resp.orh, ORH_HLEN, sr->resp.orh_dma = dma_map_single(dev, &sr->resp.orh, ORH_HLEN,
sr->out.dir); sr->out.dir);
ret = dma_mapping_error(dev, sr->resp.orh_dma); if (dma_mapping_error(dev, sr->resp.orh_dma)) {
if (ret) ret = -EINVAL;
goto orh_map_err; goto orh_map_err;
}
/* map completion */ /* map completion */
sr->resp.completion_dma = dma_map_single(dev, &sr->resp.completion, sr->resp.completion_dma = dma_map_single(dev, &sr->resp.completion,
COMP_HLEN, sr->out.dir); COMP_HLEN, sr->out.dir);
ret = dma_mapping_error(dev, sr->resp.completion_dma); if (dma_mapping_error(dev, sr->resp.completion_dma)) {
if (ret) ret = -EINVAL;
goto compl_map_err; goto compl_map_err;
}
sr->inplace = (req->src == req->dst) ? true : false; sr->inplace = (req->src == req->dst) ? true : false;
/* out place */ /* out place */
......
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