From: Lee Jones Date: Thu, 17 Sep 2015 13:45:53 +0000 (+0100) Subject: hwrng: core - Simplify RNG switching from sysfs X-Git-Url: https://git.stricted.de/?a=commitdiff_plain;h=d9a53b01404fa602117220e98bb6c9b2b63f1e7f;p=GitHub%2Fmoto-9609%2Fandroid_kernel_motorola_exynos9610.git 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 Acked-by: Peter Korsgaard Signed-off-by: Herbert Xu --- 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, return -ERESTARTSYS; err = -ENODEV; list_for_each_entry(rng, &rng_list, list) { - if (strcmp(rng->name, buf) == 0) { + if (sysfs_streq(rng->name, buf)) { err = 0; if (rng != current_rng) err = set_current_rng(rng);