diff options
author | Rusty Russell <rusty@rustcorp.com.au> | 2014-12-08 09:50:39 +0100 |
---|---|---|
committer | Herbert Xu <herbert@gondor.apana.org.au> | 2014-12-22 13:02:40 +0100 |
commit | ebbbfa248389b176e2e62d8cf91814253849ccc9 (patch) | |
tree | 8f68d43898fc9bb1fccfdb931e4192f9553fd64b /drivers/char | |
parent | hwrng: fix unregister race. (diff) | |
download | linux-ebbbfa248389b176e2e62d8cf91814253849ccc9.tar.xz linux-ebbbfa248389b176e2e62d8cf91814253849ccc9.zip |
hwrng: don't double-check old_rng.
Interesting anti-pattern.
Signed-off-by: Rusty Russell <rusty@rustcorp.com.au>
Signed-off-by: Herbert Xu <herbert@gondor.apana.org.au>
Diffstat (limited to 'drivers/char')
-rw-r--r-- | drivers/char/hw_random/core.c | 5 |
1 files changed, 2 insertions, 3 deletions
diff --git a/drivers/char/hw_random/core.c b/drivers/char/hw_random/core.c index 8d609a026465..e384ee3ed604 100644 --- a/drivers/char/hw_random/core.c +++ b/drivers/char/hw_random/core.c @@ -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(); |