/drivers/staging/dgrp: Fixed warning unchecked sscanf return value
authorAndreea-Cristina Bernat <bernat.ada@gmail.com>
Mon, 10 Mar 2014 12:01:13 +0000 (14:01 +0200)
committerPeter P Waskiewicz Jr <peter.p.waskiewicz.jr@intel.com>
Tue, 11 Mar 2014 06:25:08 +0000 (23:25 -0700)
This patch solves the warning: unchecked sscanf return value from the script
checkpatch.pl for the file dgrp_sysfs.c

Signed-off-by: Andreea-Cristina Bernat <bernat.ada@gmail.com>
Signed-off-by: Peter P Waskiewicz Jr <peter.p.waskiewicz.jr@intel.com>
drivers/staging/dgrp/dgrp_sysfs.c

index 9a18a2c..2f9345f 100644 (file)
@@ -65,7 +65,9 @@ static ssize_t dgrp_class_pollrate_store(struct device *c,
                                         struct device_attribute *attr,
                                         const char *buf, size_t count)
 {
-       sscanf(buf, "0x%x\n", &dgrp_poll_tick);
+       if (sscanf(buf, "0x%x\n", &dgrp_poll_tick) != 1)
+               return -EINVAL;
+
        return count;
 }
 static DEVICE_ATTR(pollrate, 0600, dgrp_class_pollrate_show,