From: Cristina Opriceana Date: Sun, 22 Mar 2015 18:42:42 +0000 (+0200) Subject: Staging: iio: Place driver in sleep mode on error X-Git-Tag: firefly_0821_release~176^2~1998^2~138^2~144 X-Git-Url: http://demsky.eecs.uci.edu/git/?a=commitdiff_plain;h=e6767051951353d0156efc80f7c7aa87d632d22c;p=firefly-linux-kernel-4.4.55.git 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 --- 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);