diff options
author | Dan Carpenter <dan.carpenter@oracle.com> | 2017-06-19 13:51:25 +0300 |
---|---|---|
committer | Herbert Xu <herbert@gondor.apana.org.au> | 2017-06-22 11:54:08 +0300 |
commit | f2339eb9b9b01c6728ed36c274ca381bc6c452c0 (patch) | |
tree | 43d5d99f032490bb2368839e7214ebc914ae24bf /drivers/crypto/cavium | |
parent | 8bd1d400f6a4d1fdcf79c64012602518781573e5 (diff) | |
download | linux-f2339eb9b9b01c6728ed36c274ca381bc6c452c0.tar.xz |
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: 14fa93cdcd9b ("crypto: cavium - Add support for CNN55XX adapters.")
Signed-off-by: Dan Carpenter <dan.carpenter@oracle.com>
Signed-off-by: Herbert Xu <herbert@gondor.apana.org.au>
Diffstat (limited to 'drivers/crypto/cavium')
-rw-r--r-- | drivers/crypto/cavium/nitrox/nitrox_reqmgr.c | 15 |
1 files changed, 9 insertions, 6 deletions
diff --git a/drivers/crypto/cavium/nitrox/nitrox_reqmgr.c b/drivers/crypto/cavium/nitrox/nitrox_reqmgr.c index b6bd2a870028..4bb4377c5ac0 100644 --- a/drivers/crypto/cavium/nitrox/nitrox_reqmgr.c +++ b/drivers/crypto/cavium/nitrox/nitrox_reqmgr.c @@ -199,9 +199,10 @@ static int dma_map_inbufs(struct nitrox_softreq *sr, sr->in.sglist = glist; /* map IV */ dma = dma_map_single(dev, &req->iv, req->ivsize, DMA_BIDIRECTIONAL); - ret = dma_mapping_error(dev, dma); - if (ret) + if (dma_mapping_error(dev, dma)) { + ret = -EINVAL; goto iv_map_err; + } sr->in.dir = (req->src == req->dst) ? DMA_BIDIRECTIONAL : DMA_TO_DEVICE; /* map src entries */ @@ -268,16 +269,18 @@ static int dma_map_outbufs(struct nitrox_softreq *sr, /* map ORH */ sr->resp.orh_dma = dma_map_single(dev, &sr->resp.orh, ORH_HLEN, sr->out.dir); - ret = dma_mapping_error(dev, sr->resp.orh_dma); - if (ret) + if (dma_mapping_error(dev, sr->resp.orh_dma)) { + ret = -EINVAL; goto orh_map_err; + } /* map completion */ sr->resp.completion_dma = dma_map_single(dev, &sr->resp.completion, COMP_HLEN, sr->out.dir); - ret = dma_mapping_error(dev, sr->resp.completion_dma); - if (ret) + if (dma_mapping_error(dev, sr->resp.completion_dma)) { + ret = -EINVAL; goto compl_map_err; + } sr->inplace = (req->src == req->dst) ? true : false; /* out place */ |