s390/qeth: use kstrtobool() in qeth_bridgeport_hostnotification_store()
authorAndy Shevchenko <andriy.shevchenko@linux.intel.com>
Wed, 18 Oct 2017 15:40:16 +0000 (17:40 +0200)
committerDavid S. Miller <davem@davemloft.net>
Fri, 20 Oct 2017 12:11:04 +0000 (13:11 +0100)
The sysfs enabled value is a boolean, so kstrtobool() is a better fit
for parsing the input string since it does the range checking for us.

Signed-off-by: Andy Shevchenko <andriy.shevchenko@linux.intel.com>
Signed-off-by: Julian Wiedmann <jwi@linux.vnet.ibm.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
drivers/s390/net/qeth_l2_sys.c

index 4608daedb204b6408270cde6769fe68717af27f6..470a4e5f3c623c7fd92e72b4240a2a13eeaa28fa 100644 (file)
@@ -146,18 +146,15 @@ static ssize_t qeth_bridgeport_hostnotification_store(struct device *dev,
                struct device_attribute *attr, const char *buf, size_t count)
 {
        struct qeth_card *card = dev_get_drvdata(dev);
-       int rc = 0;
-       int enable;
+       bool enable;
+       int rc;
 
        if (!card)
                return -EINVAL;
 
-       if (sysfs_streq(buf, "0"))
-               enable = 0;
-       else if (sysfs_streq(buf, "1"))
-               enable = 1;
-       else
-               return -EINVAL;
+       rc = kstrtobool(buf, &enable);
+       if (rc)
+               return rc;
 
        mutex_lock(&card->conf_mutex);