From: Luis de Bethencourt Date: Wed, 22 Jun 2016 19:43:31 +0000 (+0100) Subject: staging: iio: accel: add error check X-Git-Url: https://git.karo-electronics.de/?a=commitdiff_plain;h=aea7b1dc2bb7405f2d7827b202788fbee3912c1a;p=linux-beck.git staging: iio: accel: add error check Go to error_ret if sca3000_read_ctrl_reg() failed. Signed-off-by: Luis de Bethencourt Signed-off-by: Jonathan Cameron --- diff --git a/drivers/staging/iio/accel/sca3000_core.c b/drivers/staging/iio/accel/sca3000_core.c index a8f533af9eca..53c5425d02b3 100644 --- a/drivers/staging/iio/accel/sca3000_core.c +++ b/drivers/staging/iio/accel/sca3000_core.c @@ -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