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>
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)
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);