Commit fb1e1257 authored by Herbert Xu's avatar Herbert Xu

Revert "crypto: gemini - Fix error check for dma_map_sg"

This reverts commit 545665ad.

The original code was correct and arguably more robust than the
patched version.
Signed-off-by: default avatarHerbert Xu <herbert@gondor.apana.org.au>
parent a9a98d49
...@@ -149,7 +149,7 @@ static int sl3516_ce_cipher(struct skcipher_request *areq) ...@@ -149,7 +149,7 @@ static int sl3516_ce_cipher(struct skcipher_request *areq)
if (areq->src == areq->dst) { if (areq->src == areq->dst) {
nr_sgs = dma_map_sg(ce->dev, areq->src, sg_nents(areq->src), nr_sgs = dma_map_sg(ce->dev, areq->src, sg_nents(areq->src),
DMA_BIDIRECTIONAL); DMA_BIDIRECTIONAL);
if (!nr_sgs || nr_sgs > MAXDESC / 2) { if (nr_sgs <= 0 || nr_sgs > MAXDESC / 2) {
dev_err(ce->dev, "Invalid sg number %d\n", nr_sgs); dev_err(ce->dev, "Invalid sg number %d\n", nr_sgs);
err = -EINVAL; err = -EINVAL;
goto theend; goto theend;
...@@ -158,14 +158,14 @@ static int sl3516_ce_cipher(struct skcipher_request *areq) ...@@ -158,14 +158,14 @@ static int sl3516_ce_cipher(struct skcipher_request *areq)
} else { } else {
nr_sgs = dma_map_sg(ce->dev, areq->src, sg_nents(areq->src), nr_sgs = dma_map_sg(ce->dev, areq->src, sg_nents(areq->src),
DMA_TO_DEVICE); DMA_TO_DEVICE);
if (!nr_sgs || nr_sgs > MAXDESC / 2) { if (nr_sgs <= 0 || nr_sgs > MAXDESC / 2) {
dev_err(ce->dev, "Invalid sg number %d\n", nr_sgs); dev_err(ce->dev, "Invalid sg number %d\n", nr_sgs);
err = -EINVAL; err = -EINVAL;
goto theend; goto theend;
} }
nr_sgd = dma_map_sg(ce->dev, areq->dst, sg_nents(areq->dst), nr_sgd = dma_map_sg(ce->dev, areq->dst, sg_nents(areq->dst),
DMA_FROM_DEVICE); DMA_FROM_DEVICE);
if (!nr_sgd || nr_sgd > MAXDESC) { if (nr_sgd <= 0 || nr_sgd > MAXDESC) {
dev_err(ce->dev, "Invalid sg number %d\n", nr_sgd); dev_err(ce->dev, "Invalid sg number %d\n", nr_sgd);
err = -EINVAL; err = -EINVAL;
goto theend_sgs; goto theend_sgs;
......
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