@@ -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;
}