Commit 35fbb7f0 authored by Jishnu Prakash's avatar Jishnu Prakash Committed by Jonathan Cameron

iio: adc: Update return value checks

Clean up some return value checks to make code more compact.
Signed-off-by: default avatarJishnu Prakash <jprakash@codeaurora.org>
Signed-off-by: default avatarJonathan Cameron <Jonathan.Cameron@huawei.com>
parent 082111e5
...@@ -301,7 +301,7 @@ static int adc5_configure(struct adc5_chip *adc, ...@@ -301,7 +301,7 @@ static int adc5_configure(struct adc5_chip *adc,
/* Read registers 0x42 through 0x46 */ /* Read registers 0x42 through 0x46 */
ret = adc5_read(adc, ADC5_USR_DIG_PARAM, buf, sizeof(buf)); ret = adc5_read(adc, ADC5_USR_DIG_PARAM, buf, sizeof(buf));
if (ret < 0) if (ret)
return ret; return ret;
/* Digital param selection */ /* Digital param selection */
...@@ -388,7 +388,7 @@ static int adc5_do_conversion(struct adc5_chip *adc, ...@@ -388,7 +388,7 @@ static int adc5_do_conversion(struct adc5_chip *adc,
if (adc->poll_eoc) { if (adc->poll_eoc) {
ret = adc5_poll_wait_eoc(adc); ret = adc5_poll_wait_eoc(adc);
if (ret < 0) { if (ret) {
pr_err("EOC bit not set\n"); pr_err("EOC bit not set\n");
goto unlock; goto unlock;
} }
...@@ -398,7 +398,7 @@ static int adc5_do_conversion(struct adc5_chip *adc, ...@@ -398,7 +398,7 @@ static int adc5_do_conversion(struct adc5_chip *adc,
if (!ret) { if (!ret) {
pr_debug("Did not get completion timeout.\n"); pr_debug("Did not get completion timeout.\n");
ret = adc5_poll_wait_eoc(adc); ret = adc5_poll_wait_eoc(adc);
if (ret < 0) { if (ret) {
pr_err("EOC bit not set\n"); pr_err("EOC bit not set\n");
goto unlock; goto unlock;
} }
...@@ -516,8 +516,6 @@ static int adc5_read_raw(struct iio_dev *indio_dev, ...@@ -516,8 +516,6 @@ static int adc5_read_raw(struct iio_dev *indio_dev,
default: default:
return -EINVAL; return -EINVAL;
} }
return 0;
} }
static int adc7_read_raw(struct iio_dev *indio_dev, static int adc7_read_raw(struct iio_dev *indio_dev,
...@@ -761,7 +759,7 @@ static int adc5_get_dt_channel_data(struct adc5_chip *adc, ...@@ -761,7 +759,7 @@ static int adc5_get_dt_channel_data(struct adc5_chip *adc,
ret = adc5_read(adc, ADC5_USR_REVISION1, dig_version, ret = adc5_read(adc, ADC5_USR_REVISION1, dig_version,
sizeof(dig_version)); sizeof(dig_version));
if (ret < 0) { if (ret) {
dev_err(dev, "Invalid dig version read %d\n", ret); dev_err(dev, "Invalid dig version read %d\n", ret);
return ret; return ret;
} }
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment