public inbox for linux-crypto@vger.kernel.org
 help / color / mirror / Atom feed
* [PATCH] crypto: qce - Remove return variable and unused assignments
@ 2026-03-02 11:34 Thorsten Blum
  2026-03-02 12:47 ` Konrad Dybcio
  2026-03-14  5:07 ` Herbert Xu
  0 siblings, 2 replies; 4+ messages in thread
From: Thorsten Blum @ 2026-03-02 11:34 UTC (permalink / raw)
  To: Thara Gopinath, Herbert Xu, David S. Miller
  Cc: Thorsten Blum, linux-crypto, linux-arm-msm, linux-kernel

In qce_aead_done(), the return variable 'ret' is no longer used - remove
it. And qce_aead_prepare_dst_buf() jumps directly to 'dst_tbl_free:' on
error and returns 'sg' - drop the useless 'ret' assignments.

Signed-off-by: Thorsten Blum <thorsten.blum@linux.dev>
---
 drivers/crypto/qce/aead.c | 12 +++---------
 1 file changed, 3 insertions(+), 9 deletions(-)

diff --git a/drivers/crypto/qce/aead.c b/drivers/crypto/qce/aead.c
index 97b56e92ea33..67a87a7d6abd 100644
--- a/drivers/crypto/qce/aead.c
+++ b/drivers/crypto/qce/aead.c
@@ -35,7 +35,6 @@ static void qce_aead_done(void *data)
 	u32 status;
 	unsigned int totallen;
 	unsigned char tag[SHA256_DIGEST_SIZE] = {0};
-	int ret = 0;
 
 	diff_dst = (req->src != req->dst) ? true : false;
 	dir_src = diff_dst ? DMA_TO_DEVICE : DMA_BIDIRECTIONAL;
@@ -79,8 +78,7 @@ static void qce_aead_done(void *data)
 	} else if (!IS_CCM(rctx->flags)) {
 		totallen = req->cryptlen + req->assoclen - ctx->authsize;
 		scatterwalk_map_and_copy(tag, req->src, totallen, ctx->authsize, 0);
-		ret = memcmp(result_buf->auth_iv, tag, ctx->authsize);
-		if (ret) {
+		if (memcmp(result_buf->auth_iv, tag, ctx->authsize)) {
 			pr_err("Bad message error\n");
 			error = -EBADMSG;
 		}
@@ -144,16 +142,12 @@ qce_aead_prepare_dst_buf(struct aead_request *req)
 
 		sg = qce_sgtable_add(&rctx->dst_tbl, &rctx->adata_sg,
 				     rctx->assoclen);
-		if (IS_ERR(sg)) {
-			ret = PTR_ERR(sg);
+		if (IS_ERR(sg))
 			goto dst_tbl_free;
-		}
 		/* dst buffer */
 		sg = qce_sgtable_add(&rctx->dst_tbl, msg_sg, rctx->cryptlen);
-		if (IS_ERR(sg)) {
-			ret = PTR_ERR(sg);
+		if (IS_ERR(sg))
 			goto dst_tbl_free;
-		}
 		totallen = rctx->cryptlen + rctx->assoclen;
 	} else {
 		if (totallen) {
-- 
Thorsten Blum <thorsten.blum@linux.dev>
GPG: 1D60 735E 8AEF 3BE4 73B6  9D84 7336 78FD 8DFE EAD4


^ permalink raw reply related	[flat|nested] 4+ messages in thread

* Re: [PATCH] crypto: qce - Remove return variable and unused assignments
  2026-03-02 11:34 [PATCH] crypto: qce - Remove return variable and unused assignments Thorsten Blum
@ 2026-03-02 12:47 ` Konrad Dybcio
  2026-03-02 14:15   ` Thorsten Blum
  2026-03-14  5:07 ` Herbert Xu
  1 sibling, 1 reply; 4+ messages in thread
From: Konrad Dybcio @ 2026-03-02 12:47 UTC (permalink / raw)
  To: Thorsten Blum, Thara Gopinath, Herbert Xu, David S. Miller
  Cc: linux-crypto, linux-arm-msm, linux-kernel

On 3/2/26 12:34 PM, Thorsten Blum wrote:
> In qce_aead_done(), the return variable 'ret' is no longer used - remove
> it. And qce_aead_prepare_dst_buf() jumps directly to 'dst_tbl_free:' on
> error and returns 'sg' - drop the useless 'ret' assignments.
> 
> Signed-off-by: Thorsten Blum <thorsten.blum@linux.dev>
> ---
>  drivers/crypto/qce/aead.c | 12 +++---------
>  1 file changed, 3 insertions(+), 9 deletions(-)
> 
> diff --git a/drivers/crypto/qce/aead.c b/drivers/crypto/qce/aead.c
> index 97b56e92ea33..67a87a7d6abd 100644
> --- a/drivers/crypto/qce/aead.c
> +++ b/drivers/crypto/qce/aead.c
> @@ -35,7 +35,6 @@ static void qce_aead_done(void *data)
>  	u32 status;
>  	unsigned int totallen;
>  	unsigned char tag[SHA256_DIGEST_SIZE] = {0};
> -	int ret = 0;
>  
>  	diff_dst = (req->src != req->dst) ? true : false;
>  	dir_src = diff_dst ? DMA_TO_DEVICE : DMA_BIDIRECTIONAL;
> @@ -79,8 +78,7 @@ static void qce_aead_done(void *data)
>  	} else if (!IS_CCM(rctx->flags)) {
>  		totallen = req->cryptlen + req->assoclen - ctx->authsize;
>  		scatterwalk_map_and_copy(tag, req->src, totallen, ctx->authsize, 0);
> -		ret = memcmp(result_buf->auth_iv, tag, ctx->authsize);
> -		if (ret) {
> +		if (memcmp(result_buf->auth_iv, tag, ctx->authsize)) {
>  			pr_err("Bad message error\n");
>  			error = -EBADMSG;
>  		}
> @@ -144,16 +142,12 @@ qce_aead_prepare_dst_buf(struct aead_request *req)
>  
>  		sg = qce_sgtable_add(&rctx->dst_tbl, &rctx->adata_sg,
>  				     rctx->assoclen);
> -		if (IS_ERR(sg)) {
> -			ret = PTR_ERR(sg);
> +		if (IS_ERR(sg))
>  			goto dst_tbl_free;

This could be made much better with a DEFINE_FREE()

Konrad

^ permalink raw reply	[flat|nested] 4+ messages in thread

* Re: [PATCH] crypto: qce - Remove return variable and unused assignments
  2026-03-02 12:47 ` Konrad Dybcio
@ 2026-03-02 14:15   ` Thorsten Blum
  0 siblings, 0 replies; 4+ messages in thread
From: Thorsten Blum @ 2026-03-02 14:15 UTC (permalink / raw)
  To: Konrad Dybcio
  Cc: Thara Gopinath, Herbert Xu, David S. Miller, linux-crypto,
	linux-arm-msm, linux-kernel

On 2. Mar 2026, at 13:47, Konrad Dybcio wrote:
> On 3/2/26 12:34 PM, Thorsten Blum wrote:
>> In qce_aead_done(), the return variable 'ret' is no longer used - remove
>> it. And qce_aead_prepare_dst_buf() jumps directly to 'dst_tbl_free:' on
>> error and returns 'sg' - drop the useless 'ret' assignments.
>> 
>> Signed-off-by: Thorsten Blum <thorsten.blum@linux.dev>
>> ---
>> drivers/crypto/qce/aead.c | 12 +++---------
>> 1 file changed, 3 insertions(+), 9 deletions(-)
>> [...]
> 
> This could be made much better with a DEFINE_FREE()

I'm not sure this would be an improvement given that 'sg' points into
'rctx->dst_tbl', which is intentionally kept alive after this function.

Thanks,
Thorsten


^ permalink raw reply	[flat|nested] 4+ messages in thread

* Re: [PATCH] crypto: qce - Remove return variable and unused assignments
  2026-03-02 11:34 [PATCH] crypto: qce - Remove return variable and unused assignments Thorsten Blum
  2026-03-02 12:47 ` Konrad Dybcio
@ 2026-03-14  5:07 ` Herbert Xu
  1 sibling, 0 replies; 4+ messages in thread
From: Herbert Xu @ 2026-03-14  5:07 UTC (permalink / raw)
  To: Thorsten Blum
  Cc: Thara Gopinath, David S. Miller, linux-crypto, linux-arm-msm,
	linux-kernel

On Mon, Mar 02, 2026 at 12:34:53PM +0100, Thorsten Blum wrote:
> In qce_aead_done(), the return variable 'ret' is no longer used - remove
> it. And qce_aead_prepare_dst_buf() jumps directly to 'dst_tbl_free:' on
> error and returns 'sg' - drop the useless 'ret' assignments.
> 
> Signed-off-by: Thorsten Blum <thorsten.blum@linux.dev>
> ---
>  drivers/crypto/qce/aead.c | 12 +++---------
>  1 file changed, 3 insertions(+), 9 deletions(-)

Patch applied.  Thanks.
-- 
Email: Herbert Xu <herbert@gondor.apana.org.au>
Home Page: http://gondor.apana.org.au/~herbert/
PGP Key: http://gondor.apana.org.au/~herbert/pubkey.txt

^ permalink raw reply	[flat|nested] 4+ messages in thread

end of thread, other threads:[~2026-03-14  5:07 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2026-03-02 11:34 [PATCH] crypto: qce - Remove return variable and unused assignments Thorsten Blum
2026-03-02 12:47 ` Konrad Dybcio
2026-03-02 14:15   ` Thorsten Blum
2026-03-14  5:07 ` Herbert Xu

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox