diff options
author | Gregor Boirie <gregor.boirie@parrot.com> | 2016-04-19 11:18:40 +0200 |
---|---|---|
committer | Jonathan Cameron <jic23@kernel.org> | 2016-05-29 16:08:10 +0100 |
commit | 14f295c846063c4f1812b09427195cee522aa006 (patch) | |
tree | f989193531eba3ddb8970a5450bf43bd8e638511 /drivers/iio/pressure/st_pressure_core.c | |
parent | 169a88c1ee19b0734c9703d51a6d8ebe538f5bc3 (diff) | |
download | linux-stable-14f295c846063c4f1812b09427195cee522aa006.tar.gz linux-stable-14f295c846063c4f1812b09427195cee522aa006.tar.bz2 linux-stable-14f295c846063c4f1812b09427195cee522aa006.zip |
iio:st_sensors: fix power regulator usage
Ensure failure to enable power regulators is properly handled.
Signed-off-by: Gregor Boirie <gregor.boirie@parrot.com>
Signed-off-by: Jonathan Cameron <jic23@kernel.org>
Diffstat (limited to 'drivers/iio/pressure/st_pressure_core.c')
-rw-r--r-- | drivers/iio/pressure/st_pressure_core.c | 12 |
1 files changed, 8 insertions, 4 deletions
diff --git a/drivers/iio/pressure/st_pressure_core.c b/drivers/iio/pressure/st_pressure_core.c index c0ff3bf071d8..4d317af55405 100644 --- a/drivers/iio/pressure/st_pressure_core.c +++ b/drivers/iio/pressure/st_pressure_core.c @@ -527,13 +527,15 @@ int st_press_common_probe(struct iio_dev *indio_dev) indio_dev->info = &press_info; mutex_init(&press_data->tb.buf_lock); - st_sensors_power_enable(indio_dev); + err = st_sensors_power_enable(indio_dev); + if (err) + return err; err = st_sensors_check_device_support(indio_dev, ARRAY_SIZE(st_press_sensors_settings), st_press_sensors_settings); if (err < 0) - return err; + goto st_press_power_off; press_data->num_data_channels = ST_PRESS_NUMBER_DATA_CHANNELS; press_data->multiread_bit = press_data->sensor_settings->multi_read_bit; @@ -554,11 +556,11 @@ int st_press_common_probe(struct iio_dev *indio_dev) err = st_sensors_init_sensor(indio_dev, press_data->dev->platform_data); if (err < 0) - return err; + goto st_press_power_off; err = st_press_allocate_ring(indio_dev); if (err < 0) - return err; + goto st_press_power_off; if (irq > 0) { err = st_sensors_allocate_trigger(indio_dev, @@ -581,6 +583,8 @@ st_press_device_register_error: st_sensors_deallocate_trigger(indio_dev); st_press_probe_trigger_error: st_press_deallocate_ring(indio_dev); +st_press_power_off: + st_sensors_power_disable(indio_dev); return err; } |