Commit db42a9be authored by Tiberiu Breana's avatar Tiberiu Breana Committed by Jonathan Cameron

iio: accel: STK8BA50: suspend sensor on init errors

Put chip in 'suspend' mode in case something goes wrong
during probe.
Signed-off-by: default avatarTiberiu Breana <tiberiu.a.breana@intel.com>
Signed-off-by: default avatarJonathan Cameron <jic23@kernel.org>
parent 20833513
......@@ -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)
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment