Staging: android: timed_output.c: use kstrtoint() instead of sscanf()
authorMurilo Opsfelder Araujo <mopsfelder@gmail.com>
Mon, 28 Jul 2014 23:45:06 +0000 (20:45 -0300)
committerGreg Kroah-Hartman <gregkh@linuxfoundation.org>
Thu, 31 Jul 2014 00:17:02 +0000 (17:17 -0700)
This patch makes checkpatch.pl happy by fixing the following warning:

WARNING: Prefer kstrto<type> to single variable sscanf

Signed-off-by: Murilo Opsfelder Araujo <mopsfelder@gmail.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
drivers/staging/android/timed_output.c

index c341ac11c5a3dc8260961a8dc144a6666049e234..b41429f379fef46555fa4cf7426cbc5190b5f93a 100644 (file)
@@ -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);