Skip to content

Commit

Permalink
hwrng: don't double-check old_rng.
Browse files Browse the repository at this point in the history
Interesting anti-pattern.

Signed-off-by: Rusty Russell <rusty@rustcorp.com.au>
Signed-off-by: Herbert Xu <herbert@gondor.apana.org.au>
  • Loading branch information
Rusty Russell authored and Herbert Xu committed Dec 22, 2014
1 parent a027f30 commit ebbbfa2
Showing 1 changed file with 2 additions and 3 deletions.
5 changes: 2 additions & 3 deletions drivers/char/hw_random/core.c
Original file line number Diff line number Diff line change
Expand Up @@ -472,14 +472,13 @@ int hwrng_register(struct hwrng *rng)
}

old_rng = current_rng;
err = 0;
if (!old_rng) {
err = hwrng_init(rng);
if (err)
goto out_unlock;
set_current_rng(rng);
}
err = 0;
if (!old_rng) {

err = register_miscdev();
if (err) {
drop_current_rng();
Expand Down

0 comments on commit ebbbfa2

Please sign in to comment.