[PATCH 7/7] powerpc/pseries: replace sscanf by kstrtoul

From: Fabian Frederick
Date: Sat Jul 12 2014 - 07:38:07 EST


See checkpatch warning
"Prefer kstrto<type> to single variable sscanf"

Signed-off-by: Fabian Frederick <fabf@xxxxxxxxx>
---
arch/powerpc/platforms/pseries/power.c | 5 ++---
1 file changed, 2 insertions(+), 3 deletions(-)

diff --git a/arch/powerpc/platforms/pseries/power.c b/arch/powerpc/platforms/pseries/power.c
index 6d62662..27a3e9c 100644
--- a/arch/powerpc/platforms/pseries/power.c
+++ b/arch/powerpc/platforms/pseries/power.c
@@ -38,11 +38,10 @@ static ssize_t auto_poweron_store(struct kobject *kobj,
struct kobj_attribute *attr,
const char *buf, size_t n)
{
- int ret;
unsigned long ups_restart;
- ret = sscanf(buf, "%lu", &ups_restart);
+ int ret = kstrtoul(buf, 0, &ups_restart);

- if ((ret == 1) && ((ups_restart == 1) || (ups_restart == 0))){
+ if ((!ret) && ((ups_restart == 1) || (ups_restart == 0))) {
rtas_poweron_auto = ups_restart;
return n;
}
--
1.9.1

--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/