crypto: qce - Remove return variable and unused assignments
Subsystems (3)
PATCH 1/1 crypto: qce - Remove return variable and unused assignments
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.
--- drivers/crypto/qce/aead.c | 12 +++--------- 1 file changed, 3 insertions(+), 9 deletions(-)
drivers/crypto/qce/aead.c +3 -9
@@ -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) {
Signature · 2 lines
Thorsten Blum <[email protected]> GPG: 1D60 735E 8AEF 3BE4 73B6 9D84 7336 78FD 8DFE EAD4
Quoted 32 lines · Thorsten Blum
In
qce_aead_done(), the return variable 'ret' is no longer used - remove it. Andqce_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 <[email protected]>--- drivers/crypto/qce/aead.c | 12 +++--------- 1 file changed, 3 insertions(+), 9 deletions(-)drivers/crypto/qce/aead.c +1
-3@@ -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 ; }
drivers/crypto/qce/aead.c qce_aead_prepare_dst_buf(struct aead_request *req) · line 146
Quoted 7 lines
drivers/crypto/qce/aead.c +1
-2@@ -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
Quoted 5 lines · Konrad Dybcio
Quoted 4 lines · Thorsten Blum
In
qce_aead_done(), the return variable 'ret' is no longer used - remove it. Andqce_aead_prepare_dst_buf()jumps directly to 'dst_tbl_free:' on error and returns 'sg' - drop the useless 'ret' assignments.
Quoted 7 lines
Quoted 5 lines
Signed-off-by Thorsten Blum <[email protected]>---
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
Herbert Xu
maintainerQuoted 8 lines · Thorsten Blum
In
qce_aead_done(), the return variable 'ret' is no longer used - remove it. Andqce_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 <[email protected]>--- drivers/crypto/qce/aead.c | 12 +++--------- 1 file changed, 3 insertions(+), 9 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