diff mbox

[2/3] crypto-ansi_cprng: Delete two variable assignments in get_prng_bytes()

Message ID 7318b066-5233-426e-4b21-d4969b96bf67@users.sourceforge.net (mailing list archive)
State Rejected
Delegated to: Herbert Xu
Headers show

Commit Message

SF Markus Elfring Oct. 21, 2017, 5:15 p.m. UTC
From: Markus Elfring <elfring@users.sourceforge.net>
Date: Sat, 21 Oct 2017 16:10:43 +0200

Adjust a jump target so that two error code assignments which are redundant
before condition checks can be removed because the same value will be set
as an exception handling at the end of this function.

Signed-off-by: Markus Elfring <elfring@users.sourceforge.net>
---
 crypto/ansi_cprng.c | 8 +++-----
 1 file changed, 3 insertions(+), 5 deletions(-)
diff mbox

Patch

diff --git a/crypto/ansi_cprng.c b/crypto/ansi_cprng.c
index 111c8982a47f..3d805bf6d0c6 100644
--- a/crypto/ansi_cprng.c
+++ b/crypto/ansi_cprng.c
@@ -192,19 +192,16 @@  static int get_prng_bytes(char *buf, size_t nbytes, struct prng_context *ctx,
 
 
 	spin_lock_bh(&ctx->prng_lock);
-
-	err = -EINVAL;
 	if (ctx->flags & PRNG_NEED_RESET)
-		goto unlock;
+		goto failure_indication;
 
 	/*
 	 * If the FIXED_SIZE flag is on, only return whole blocks of
 	 * pseudo random data
 	 */
-	err = -EINVAL;
 	if (ctx->flags & PRNG_FIXED_SIZE) {
 		if (nbytes < DEFAULT_BLK_SZ)
-			goto unlock;
+			goto failure_indication;
 		byte_count = DEFAULT_BLK_SZ;
 	}
 
@@ -267,6 +264,7 @@  static int get_prng_bytes(char *buf, size_t nbytes, struct prng_context *ctx,
 
 reset_memory:
 	memset(buf, 0, nbytes);
+failure_indication:
 	err = -EINVAL;
 	goto unlock;
 }