From: Jonathan Cameron Date: Sat, 21 Apr 2012 09:09:32 +0000 (+0100) Subject: staging:iio:buffer trivial use of strtobool to remove dodgy equivalent. X-Git-Url: https://git.karo-electronics.de/?a=commitdiff_plain;h=a714af276f5002b44e97a2d6d03f85bdae627c41;p=linux-beck.git staging:iio:buffer trivial use of strtobool to remove dodgy equivalent. Signed-off-by: Jonathan Cameron Acked-by: Lars-Peter Clausen Signed-off-by: Greg Kroah-Hartman --- diff --git a/drivers/staging/iio/industrialio-buffer.c b/drivers/staging/iio/industrialio-buffer.c index 386ba760f3f1..59b0caf5deab 100644 --- a/drivers/staging/iio/industrialio-buffer.c +++ b/drivers/staging/iio/industrialio-buffer.c @@ -124,13 +124,15 @@ static ssize_t iio_scan_el_store(struct device *dev, const char *buf, size_t len) { - int ret = 0; + int ret; bool state; struct iio_dev *indio_dev = dev_get_drvdata(dev); struct iio_buffer *buffer = indio_dev->buffer; struct iio_dev_attr *this_attr = to_iio_dev_attr(attr); - state = !(buf[0] == '0'); + ret = strtobool(buf, &state); + if (ret < 0) + return ret; mutex_lock(&indio_dev->mlock); if (iio_buffer_enabled(indio_dev)) { ret = -EBUSY; @@ -169,11 +171,14 @@ static ssize_t iio_scan_el_ts_store(struct device *dev, const char *buf, size_t len) { - int ret = 0; + int ret; struct iio_dev *indio_dev = dev_get_drvdata(dev); bool state; - state = !(buf[0] == '0'); + ret = strtobool(buf, &state); + if (ret < 0) + return ret; + mutex_lock(&indio_dev->mlock); if (iio_buffer_enabled(indio_dev)) { ret = -EBUSY;