staging: iio: accel: fix error check
authorLuis de Bethencourt <luisbg@osg.samsung.com>
Wed, 22 Jun 2016 19:43:30 +0000 (20:43 +0100)
committerJonathan Cameron <jic23@kernel.org>
Sun, 26 Jun 2016 14:57:02 +0000 (15:57 +0100)
sca3000_read_ctrl_reg() returns a negative number on failure, check for
this instead of zero.

Signed-off-by: Luis de Bethencourt <luisbg@osg.samsung.com>
Cc: <Stable@vger.kernel.org>
Signed-off-by: Jonathan Cameron <jic23@kernel.org>
drivers/staging/iio/accel/sca3000_core.c

index a8f533af9ecaeffcd39143ca1379dd8186714179..ec12181822e659a508a977caf5e8acf43b7472ed 100644 (file)
@@ -594,7 +594,7 @@ static ssize_t sca3000_read_frequency(struct device *dev,
                goto error_ret_mut;
        ret = sca3000_read_ctrl_reg(st, SCA3000_REG_CTRL_SEL_OUT_CTRL);
        mutex_unlock(&st->lock);
-       if (ret)
+       if (ret < 0)
                goto error_ret;
        val = ret;
        if (base_freq > 0)