Skip to contentSkip to conversation

Staging: android: timed_output.c: use kstrtoint() instead of sscanf()

PATCH New Murilo Opsfelder Araujo 1 participant 1 message Jul 28, 2014 Staging

lore
Share & tools
lore
#0 lore raw

PATCH 1/1 Staging: android: timed_output.c: use kstrtoint() instead of sscanf()

This patch makes checkpatch.pl happy by fixing the following warning:

WARNING: Prefer kstrto<type> to single variable sscanf

---
 drivers/staging/android/timed_output.c |    4 +++-
 1 file changed, 3 insertions(+), 1 deletion(-)
drivers/staging/android/timed_output.c +3 -1
index c341ac1..b41429f 100644
@@ -41,8 +41,10 @@ static ssize_t enable_store(struct device *dev, struct device_attribute *attr,
 {
 	struct timed_output_dev *tdev = dev_get_drvdata(dev);
 	int value;
+	int rc;
 
-	if (sscanf(buf, "%d", &value) != 1)
+	rc = kstrtoint(buf, 0, &value);
+	if (rc != 0)
 		return -EINVAL;
 
 	tdev->enable(tdev, value);
Signature · 1 line
1.7.10.4