diff options
author | Cristina Opriceana <cristina.opriceana@gmail.com> | 2015-03-22 18:42:42 (GMT) |
---|---|---|
committer | Greg Kroah-Hartman <gregkh@linuxfoundation.org> | 2015-03-23 21:20:58 (GMT) |
commit | e6767051951353d0156efc80f7c7aa87d632d22c (patch) | |
tree | e6ec4eb2898b9287aaf7a84bb40c803ab0bc6efb /drivers/staging/iio | |
parent | daf56d91a56d41d97fda9f5979657abbd6475140 (diff) | |
download | linux-e6767051951353d0156efc80f7c7aa87d632d22c.tar.xz |
Staging: iio: Place driver in sleep mode on error
Put device in sleep mode if an error is encountered after
initialization in order to avoid wasting power.
Signed-off-by: Cristina Opriceana <cristina.opriceana@gmail.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
Diffstat (limited to 'drivers/staging/iio')
-rw-r--r-- | drivers/staging/iio/magnetometer/hmc5843_core.c | 4 |
1 files changed, 3 insertions, 1 deletions
diff --git a/drivers/staging/iio/magnetometer/hmc5843_core.c b/drivers/staging/iio/magnetometer/hmc5843_core.c index 0074af2..6f6e96d 100644 --- a/drivers/staging/iio/magnetometer/hmc5843_core.c +++ b/drivers/staging/iio/magnetometer/hmc5843_core.c @@ -611,7 +611,7 @@ int hmc5843_common_probe(struct device *dev, struct regmap *regmap, ret = iio_triggered_buffer_setup(indio_dev, NULL, hmc5843_trigger_handler, NULL); if (ret < 0) - return ret; + goto buffer_setup_err; ret = iio_device_register(indio_dev); if (ret < 0) @@ -621,6 +621,8 @@ int hmc5843_common_probe(struct device *dev, struct regmap *regmap, buffer_cleanup: iio_triggered_buffer_cleanup(indio_dev); +buffer_setup_err: + hmc5843_set_mode(iio_priv(indio_dev), HMC5843_MODE_SLEEP); return ret; } EXPORT_SYMBOL(hmc5843_common_probe); |