staging: iio: accel: add error check
authorLuis de Bethencourt <luisbg@osg.samsung.com>
Wed, 22 Jun 2016 19:43:31 +0000 (20:43 +0100)
committerJonathan Cameron <jic23@kernel.org>
Mon, 27 Jun 2016 19:59:10 +0000 (20:59 +0100)
Go to error_ret if sca3000_read_ctrl_reg() failed.

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

index a8f533af9ecaeffcd39143ca1379dd8186714179..53c5425d02b3f162e574c3acb5c6ed634009f5cc 100644 (file)
@@ -1046,6 +1046,8 @@ static int sca3000_clean_setup(struct sca3000_state *st)
 
        /* Disable ring buffer */
        ret = sca3000_read_ctrl_reg(st, SCA3000_REG_CTRL_SEL_OUT_CTRL);
+       if (ret < 0)
+               goto error_ret;
        ret = sca3000_write_ctrl_reg(st, SCA3000_REG_CTRL_SEL_OUT_CTRL,
                                     (ret & SCA3000_OUT_CTRL_PROT_MASK)
                                     | SCA3000_OUT_CTRL_BUF_X_EN