From: Rusty Russell Date: Mon, 8 Dec 2014 08:50:39 +0000 (+0800) Subject: hwrng: don't double-check old_rng. X-Git-Tag: v4.14-rc1~5945^2~58 X-Git-Url: http://review.tizen.org/git/?a=commitdiff_plain;h=ebbbfa248389b176e2e62d8cf91814253849ccc9;p=platform%2Fkernel%2Flinux-rpi.git hwrng: don't double-check old_rng. Interesting anti-pattern. Signed-off-by: Rusty Russell Signed-off-by: Herbert Xu --- diff --git a/drivers/char/hw_random/core.c b/drivers/char/hw_random/core.c index 8d609a0..e384ee3 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();