[PATCH 3/7] powerpc/powernv: replace sscanf %lx by kstrtoul 16

Fabian Frederick fabf at skynet.be
Sat Jul 12 21:36:16 EST 2014


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

Signed-off-by: Fabian Frederick <fabf at skynet.be>
---
 arch/powerpc/platforms/powernv/subcore.c | 6 +++---
 1 file changed, 3 insertions(+), 3 deletions(-)

diff --git a/arch/powerpc/platforms/powernv/subcore.c b/arch/powerpc/platforms/powernv/subcore.c
index 894ecb3..79721b2 100644
--- a/arch/powerpc/platforms/powernv/subcore.c
+++ b/arch/powerpc/platforms/powernv/subcore.c
@@ -337,9 +337,9 @@ static ssize_t __used store_subcores_per_core(struct device *dev,
 
 	/* We are serialised by the attribute lock */
 
-	rc = sscanf(buf, "%lx", &val);
-	if (rc != 1)
-		return -EINVAL;
+	rc = kstrtoul(buf, 16, &val);
+	if (rc)
+		return rc;
 
 	switch (val) {
 	case 1:
-- 
1.9.1



More information about the Linuxppc-dev mailing list