aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorLee Jones <lee.jones@linaro.org>2015-09-17 09:45:53 -0400
committerHerbert Xu <herbert@gondor.apana.org.au>2015-09-21 10:00:41 -0400
commitd9a53b01404fa602117220e98bb6c9b2b63f1e7f (patch)
tree786e8e3202a05a8865d18396f874eef3167ffe7f
parentcb2c316b22d89072643d2685ef0eb883cae8a9de (diff)
hwrng: core - Simplify RNG switching from sysfs
If we attempt to use sysfs to change the current RNG in the usual way i.e. issuing something like: `echo 8a8a000.rng > /sys/devices/virtual/misc/hw_random/rng_current` ... it will fail because the code doesn't currently take the '\n' into consideration. Well, now it does. Signed-off-by: Lee Jones <lee.jones@linaro.org> Acked-by: Peter Korsgaard <peter@korsgaard.com> Signed-off-by: Herbert Xu <herbert@gondor.apana.org.au>
-rw-r--r--drivers/char/hw_random/core.c2
1 files changed, 1 insertions, 1 deletions
diff --git a/drivers/char/hw_random/core.c b/drivers/char/hw_random/core.c
index 5643b65cee20..6f497aa1b276 100644
--- a/drivers/char/hw_random/core.c
+++ b/drivers/char/hw_random/core.c
@@ -323,7 +323,7 @@ static ssize_t hwrng_attr_current_store(struct device *dev,
323 return -ERESTARTSYS; 323 return -ERESTARTSYS;
324 err = -ENODEV; 324 err = -ENODEV;
325 list_for_each_entry(rng, &rng_list, list) { 325 list_for_each_entry(rng, &rng_list, list) {
326 if (strcmp(rng->name, buf) == 0) { 326 if (sysfs_streq(rng->name, buf)) {
327 err = 0; 327 err = 0;
328 if (rng != current_rng) 328 if (rng != current_rng)
329 err = set_current_rng(rng); 329 err = set_current_rng(rng);