Patchwork crypto: rsa - Remove unneeded error assignment

login
register
mail settings
Submitter Fabio Estevam
Date April 11, 2018, 9:37 p.m.
Message ID <1523482637-12128-1-git-send-email-festevam@gmail.com>
Download mbox | patch
Permalink /patch/10337467/
State Accepted
Delegated to: Herbert Xu
Headers show

Comments

Fabio Estevam - April 11, 2018, 9:37 p.m.
From: Fabio Estevam <fabio.estevam@nxp.com>

There is no need to assign an error value to 'ret' prior
to calling mpi_read_raw_from_sgl() because in the case
of error the 'ret' variable will be assigned to the error
code inside the if block.

In the case of non failure, 'ret' will be overwritten
immediately after, so remove the unneeded assignment.

Signed-off-by: Fabio Estevam <fabio.estevam@nxp.com>
---
 crypto/rsa.c | 1 -
 1 file changed, 1 deletion(-)
Herbert Xu - April 20, 2018, 4:54 p.m.
On Wed, Apr 11, 2018 at 06:37:17PM -0300, Fabio Estevam wrote:
> From: Fabio Estevam <fabio.estevam@nxp.com>
> 
> There is no need to assign an error value to 'ret' prior
> to calling mpi_read_raw_from_sgl() because in the case
> of error the 'ret' variable will be assigned to the error
> code inside the if block.
> 
> In the case of non failure, 'ret' will be overwritten
> immediately after, so remove the unneeded assignment.
> 
> Signed-off-by: Fabio Estevam <fabio.estevam@nxp.com>

Patch applied.  Thanks.

Patch

diff --git a/crypto/rsa.c b/crypto/rsa.c
index b067f3a..4167980 100644
--- a/crypto/rsa.c
+++ b/crypto/rsa.c
@@ -215,7 +215,6 @@  static int rsa_verify(struct akcipher_request *req)
 		goto err_free_m;
 	}
 
-	ret = -ENOMEM;
 	s = mpi_read_raw_from_sgl(req->src, req->src_len);
 	if (!s) {
 		ret = -ENOMEM;