Commit 753a9870 authored by Mircea Caprioru's avatar Mircea Caprioru Committed by Jonathan Cameron

staging: iio: adc: ad7192: Report error directly in ad7192_setup

This patch removes the goto out statement and uninformative
print message. This improves readability.
Signed-off-by: default avatarMircea Caprioru <mircea.caprioru@analog.com>
Signed-off-by: default avatarJonathan Cameron <Jonathan.Cameron@huawei.com>
parent 3ad7a939
...@@ -260,13 +260,13 @@ static int ad7192_setup(struct ad7192_state *st, ...@@ -260,13 +260,13 @@ static int ad7192_setup(struct ad7192_state *st,
/* reset the serial interface */ /* reset the serial interface */
ret = ad_sd_reset(&st->sd, 48); ret = ad_sd_reset(&st->sd, 48);
if (ret < 0) if (ret < 0)
goto out; return ret;
usleep_range(500, 1000); /* Wait for at least 500us */ usleep_range(500, 1000); /* Wait for at least 500us */
/* write/read test for device presence */ /* write/read test for device presence */
ret = ad_sd_read_reg(&st->sd, AD7192_REG_ID, 1, &id); ret = ad_sd_read_reg(&st->sd, AD7192_REG_ID, 1, &id);
if (ret) if (ret)
goto out; return ret;
id &= AD7192_ID_MASK; id &= AD7192_ID_MASK;
...@@ -314,15 +314,15 @@ static int ad7192_setup(struct ad7192_state *st, ...@@ -314,15 +314,15 @@ static int ad7192_setup(struct ad7192_state *st,
ret = ad_sd_write_reg(&st->sd, AD7192_REG_MODE, 3, st->mode); ret = ad_sd_write_reg(&st->sd, AD7192_REG_MODE, 3, st->mode);
if (ret) if (ret)
goto out; return ret;
ret = ad_sd_write_reg(&st->sd, AD7192_REG_CONF, 3, st->conf); ret = ad_sd_write_reg(&st->sd, AD7192_REG_CONF, 3, st->conf);
if (ret) if (ret)
goto out; return ret;
ret = ad7192_calibrate_all(st); ret = ad7192_calibrate_all(st);
if (ret) if (ret)
goto out; return ret;
/* Populate available ADC input ranges */ /* Populate available ADC input ranges */
for (i = 0; i < ARRAY_SIZE(st->scale_avail); i++) { for (i = 0; i < ARRAY_SIZE(st->scale_avail); i++) {
...@@ -336,9 +336,6 @@ static int ad7192_setup(struct ad7192_state *st, ...@@ -336,9 +336,6 @@ static int ad7192_setup(struct ad7192_state *st,
} }
return 0; return 0;
out:
dev_err(&st->sd.spi->dev, "setup failed\n");
return ret;
} }
static ssize_t static ssize_t
......
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