aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/char
diff options
context:
space:
mode:
authorRusty Russell <rusty@rustcorp.com.au>2014-12-08 03:50:39 -0500
committerHerbert Xu <herbert@gondor.apana.org.au>2014-12-22 07:02:40 -0500
commitebbbfa248389b176e2e62d8cf91814253849ccc9 (patch)
tree8f68d43898fc9bb1fccfdb931e4192f9553fd64b /drivers/char
parenta027f30d72f2c4d27d6dd9bd053205d3102de7d1 (diff)
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.c5
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)
472 } 472 }
473 473
474 old_rng = current_rng; 474 old_rng = current_rng;
475 err = 0;
475 if (!old_rng) { 476 if (!old_rng) {
476 err = hwrng_init(rng); 477 err = hwrng_init(rng);
477 if (err) 478 if (err)
478 goto out_unlock; 479 goto out_unlock;
479 set_current_rng(rng); 480 set_current_rng(rng);
480 } 481
481 err = 0;
482 if (!old_rng) {
483 err = register_miscdev(); 482 err = register_miscdev();
484 if (err) { 483 if (err) {
485 drop_current_rng(); 484 drop_current_rng();