Skip to contentSkip to conversation

crypto: qce: skcipher: fix error return code in qce_skcipher_async_req_handle()

PATCH In review Wei Yongjun 3 participants 3 messages Jun 2, 2021 – Jun 11, 2021

Subsystems (4)
lore
Share & tools
lore
#0 lore raw

PATCH 1/1 crypto: qce: skcipher: fix error return code in qce_skcipher_async_req_handle()

Fix to return a negative error code from the error handling case instead of 0, as done elsewhere in this function.

Fixes 1339a7c3ba05 ("crypto: qce: skcipher: Fix incorrect sg count for dma transfers")
---
 drivers/crypto/qce/skcipher.c | 8 ++++++--
 1 file changed, 6 insertions(+), 2 deletions(-)
drivers/crypto/qce/skcipher.c +6 -2
index 259418479227..8ff10928f581 100644
@@ -124,13 +124,17 @@ qce_skcipher_async_req_handle(struct crypto_async_request *async_req)
 	rctx->dst_sg = rctx->dst_tbl.sgl;
 
 	dst_nents = dma_map_sg(qce->dev, rctx->dst_sg, rctx->dst_nents, dir_dst);
-	if (dst_nents < 0)
+	if (dst_nents < 0) {
+		ret = dst_nents;
 		goto error_free;
+	}
 
 	if (diff_dst) {
 		src_nents = dma_map_sg(qce->dev, req->src, rctx->src_nents, dir_src);
-		if (src_nents < 0)
+		if (src_nents < 0) {
+			ret = src_nents;
 			goto error_unmap_dst;
+		}
 		rctx->src_sg = req->src;
 	} else {
 		rctx->src_sg = rctx->dst_sg;
Reviewed-by on v1 1/1
#1 lore raw
Quoted 6 lines · Wei Yongjun

Fix to return a negative error code from the error handling case instead of 0, as done elsewhere in this function.

Fixes 1339a7c3ba05 ("crypto: qce: skcipher: Fix incorrect sg count for dma transfers")
Signature · 2 lines
Warm Regards
Thara
Quoted 29 lines
---
  drivers/crypto/qce/skcipher.c | 8 ++++++--
  1 file changed, 6 insertions(+), 2 deletions(-)
drivers/crypto/qce/skcipher.c +6 -2
index 259418479227..8ff10928f581 100644
@@ -124,13 +124,17 @@ qce_skcipher_async_req_handle(struct crypto_async_request *async_req)
  	rctx->dst_sg = rctx->dst_tbl.sgl;
 
  	dst_nents = dma_map_sg(qce->dev, rctx->dst_sg, rctx->dst_nents, dir_dst);
-	if (dst_nents < 0)
+	if (dst_nents < 0) {
+		ret = dst_nents;
  		goto error_free;
+	}
 
  	if (diff_dst) {
  		src_nents = dma_map_sg(qce->dev, req->src, rctx->src_nents, dir_src);
-		if (src_nents < 0)
+		if (src_nents < 0) {
+			ret = src_nents;
  			goto error_unmap_dst;
+		}
  		rctx->src_sg = req->src;
  	} else {
  		rctx->src_sg = rctx->dst_sg;
maintainer
#2 lore raw
In reply to Wei Yongjun
Quoted 9 lines · Wei Yongjun

Fix to return a negative error code from the error handling case instead of 0, as done elsewhere in this function.

Fixes 1339a7c3ba05 ("crypto: qce: skcipher: Fix incorrect sg count for dma transfers")
---
 drivers/crypto/qce/skcipher.c | 8 ++++++--
 1 file changed, 6 insertions(+), 2 deletions(-)

Patch applied. Thanks.

Signature · 3 lines
Email: Herbert Xu <[email protected]>
Home Page: http://gondor.apana.org.au/~herbert/
PGP Key: http://gondor.apana.org.au/~herbert/pubkey.txt