crypto: chelsio - Fix an error code in chcr_hash_dma_map()
authorDan Carpenter <dan.carpenter@oracle.com>
Thu, 9 Nov 2017 21:25:43 +0000 (00:25 +0300)
committerHerbert Xu <herbert@gondor.apana.org.au>
Wed, 29 Nov 2017 05:43:49 +0000 (16:43 +1100)
The dma_map_sg() function returns zero on error and positive values on
success.  We want to return -ENOMEM on failure here and zero on success.

Fixes: 2f47d5804311 ("crypto: chelsio - Move DMA un/mapping to chcr from lld cxgb4 driver")
Signed-off-by: Dan Carpenter <dan.carpenter@oracle.com>
Signed-off-by: Herbert Xu <herbert@gondor.apana.org.au>
drivers/crypto/chelsio/chcr_algo.c

index 300e66fe8a3cf5d24bb40e9dc36d2938db9f5168..af08dd264ca70ad62725b655ba983f06550cc94d 100644 (file)
@@ -2410,7 +2410,7 @@ static inline int chcr_hash_dma_map(struct device *dev,
        error = dma_map_sg(dev, req->src, sg_nents(req->src),
                           DMA_TO_DEVICE);
        if (!error)
-               return error;
+               return -ENOMEM;
        req_ctx->is_sg_map = 1;
        return 0;
 }