[PATCH 7/7] powerpc/pseries: replace sscanf by kstrtoul
Fabian Frederick
fabf at skynet.be
Sat Jul 12 21:36:20 EST 2014
See checkpatch warning
"Prefer kstrto<type> to single variable sscanf"
Signed-off-by: Fabian Frederick <fabf at skynet.be>
---
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
More information about the Linuxppc-dev
mailing list