summaryrefslogtreecommitdiffstats
path: root/drivers/iio/accel/stk8ba50.c
diff options
context:
space:
mode:
authorTiberiu Breana <tiberiu.a.breana@intel.com>2015-06-19 17:56:37 +0300
committerJonathan Cameron <jic23@kernel.org>2015-06-21 13:53:03 +0100
commitdb42a9be9f05516255e749a5ee4c1e5d07e0a73b (patch)
tree9cf74fcba4151ceb1806c26cfc0bfd5249765754 /drivers/iio/accel/stk8ba50.c
parent208335138001015fd7c5c986b39e05fffad1c528 (diff)
downloadlinux-db42a9be9f05516255e749a5ee4c1e5d07e0a73b.tar.gz
linux-db42a9be9f05516255e749a5ee4c1e5d07e0a73b.tar.bz2
linux-db42a9be9f05516255e749a5ee4c1e5d07e0a73b.zip
iio: accel: STK8BA50: suspend sensor on init errors
Put chip in 'suspend' mode in case something goes wrong during probe. Signed-off-by: Tiberiu Breana <tiberiu.a.breana@intel.com> Signed-off-by: Jonathan Cameron <jic23@kernel.org>
Diffstat (limited to 'drivers/iio/accel/stk8ba50.c')
-rw-r--r--drivers/iio/accel/stk8ba50.c8
1 files changed, 6 insertions, 2 deletions
diff --git a/drivers/iio/accel/stk8ba50.c b/drivers/iio/accel/stk8ba50.c
index 92229bd8c82d..9836880cc2d1 100644
--- a/drivers/iio/accel/stk8ba50.c
+++ b/drivers/iio/accel/stk8ba50.c
@@ -265,7 +265,7 @@ static int stk8ba50_probe(struct i2c_client *client,
STK8BA50_REG_SWRST, STK8BA50_RESET_CMD);
if (ret < 0) {
dev_err(&client->dev, "failed to reset sensor\n");
- return ret;
+ goto err_power_off;
}
/* The default range is +/-2g */
@@ -277,10 +277,14 @@ static int stk8ba50_probe(struct i2c_client *client,
ret = iio_device_register(indio_dev);
if (ret < 0) {
dev_err(&client->dev, "device_register failed\n");
- stk8ba50_set_power(data, STK8BA50_MODE_SUSPEND);
+ goto err_power_off;
}
return ret;
+
+err_power_off:
+ stk8ba50_set_power(data, STK8BA50_MODE_SUSPEND);
+ return ret;
}
static int stk8ba50_remove(struct i2c_client *client)