[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-Id: <1411043867-21109-6-git-send-email-akong@redhat.com>
Date: Thu, 18 Sep 2014 20:37:46 +0800
From: Amos Kong <akong@...hat.com>
To: virtualization@...ts.linux-foundation.org
Cc: kvm@...r.kernel.org, herbert@...dor.apana.org.au, m@...s.ch,
mpm@...enic.com, amit.shah@...hat.com, rusty@...tcorp.com.au,
linux-kernel@...r.kernel.org
Subject: [PATCH v2 5/6] hw_random: don't double-check old_rng.
From: Rusty Russell <rusty@...tcorp.com.au>
Interesting anti-pattern.
Signed-off-by: Rusty Russell <rusty@...tcorp.com.au>
---
drivers/char/hw_random/core.c | 5 ++---
1 file changed, 2 insertions(+), 3 deletions(-)
diff --git a/drivers/char/hw_random/core.c b/drivers/char/hw_random/core.c
index 9f6f5bb..6420409 100644
--- a/drivers/char/hw_random/core.c
+++ b/drivers/char/hw_random/core.c
@@ -473,14 +473,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();
--
1.9.3
--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@...r.kernel.org
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/
Powered by blists - more mailing lists