From e6767051951353d0156efc80f7c7aa87d632d22c Mon Sep 17 00:00:00 2001 From: Cristina Opriceana Date: Sun, 22 Mar 2015 20:42:42 +0200 Subject: [PATCH] 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 Signed-off-by: Greg Kroah-Hartman --- drivers/staging/iio/magnetometer/hmc5843_core.c | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/drivers/staging/iio/magnetometer/hmc5843_core.c b/drivers/staging/iio/magnetometer/hmc5843_core.c index 0074af2750a5..6f6e96d71462 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); -- 2.34.1