|
@@ -174,13 +174,15 @@ static int ad7780_probe(struct spi_device *spi)
|
|
|
ad_sd_init(&st->sd, indio_dev, spi, &ad7780_sigma_delta_info);
|
|
|
|
|
|
st->reg = devm_regulator_get(&spi->dev, "avdd");
|
|
|
- if (!IS_ERR(st->reg)) {
|
|
|
- ret = regulator_enable(st->reg);
|
|
|
- if (ret)
|
|
|
- return ret;
|
|
|
+ if (IS_ERR(st->reg))
|
|
|
+ return PTR_ERR(st->reg);
|
|
|
|
|
|
- voltage_uv = regulator_get_voltage(st->reg);
|
|
|
+ ret = regulator_enable(st->reg);
|
|
|
+ if (ret) {
|
|
|
+ dev_err(&spi->dev, "Failed to enable specified AVdd supply\n");
|
|
|
+ return ret;
|
|
|
}
|
|
|
+ voltage_uv = regulator_get_voltage(st->reg);
|
|
|
|
|
|
st->chip_info =
|
|
|
&ad7780_chip_info_tbl[spi_get_device_id(spi)->driver_data];
|
|
@@ -222,8 +224,7 @@ static int ad7780_probe(struct spi_device *spi)
|
|
|
error_cleanup_buffer_and_trigger:
|
|
|
ad_sd_cleanup_buffer_and_trigger(indio_dev);
|
|
|
error_disable_reg:
|
|
|
- if (!IS_ERR(st->reg))
|
|
|
- regulator_disable(st->reg);
|
|
|
+ regulator_disable(st->reg);
|
|
|
|
|
|
return ret;
|
|
|
}
|
|
@@ -236,8 +237,7 @@ static int ad7780_remove(struct spi_device *spi)
|
|
|
iio_device_unregister(indio_dev);
|
|
|
ad_sd_cleanup_buffer_and_trigger(indio_dev);
|
|
|
|
|
|
- if (!IS_ERR(st->reg))
|
|
|
- regulator_disable(st->reg);
|
|
|
+ regulator_disable(st->reg);
|
|
|
|
|
|
return 0;
|
|
|
}
|