All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH v2 1/2] iio: accel: STK8BA50: suspend sensor on init errors
@ 2015-06-19 14:56 Tiberiu Breana
  2015-06-19 14:56 ` [PATCH v2 2/2] iio: accel: Add trigger support for STK8BA50 Tiberiu Breana
  2015-06-21 12:53 ` [PATCH v2 1/2] iio: accel: STK8BA50: suspend sensor on init errors Jonathan Cameron
  0 siblings, 2 replies; 4+ messages in thread
From: Tiberiu Breana @ 2015-06-19 14:56 UTC (permalink / raw)
  To: linux-iio; +Cc: Jonathan Cameron

Put chip in 'suspend' mode in case something goes wrong
during probe.

Signed-off-by: Tiberiu Breana <tiberiu.a.breana@intel.com>
---
no changes since v1
---
 drivers/iio/accel/stk8ba50.c | 8 ++++++--
 1 file changed, 6 insertions(+), 2 deletions(-)

diff --git a/drivers/iio/accel/stk8ba50.c b/drivers/iio/accel/stk8ba50.c
index 92229bd..9836880 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)
-- 
1.9.1

--
To unsubscribe from this list: send the line "unsubscribe linux-iio" in

^ permalink raw reply related	[flat|nested] 4+ messages in thread

end of thread, other threads:[~2015-06-21 12:58 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2015-06-19 14:56 [PATCH v2 1/2] iio: accel: STK8BA50: suspend sensor on init errors Tiberiu Breana
2015-06-19 14:56 ` [PATCH v2 2/2] iio: accel: Add trigger support for STK8BA50 Tiberiu Breana
2015-06-21 12:58   ` Jonathan Cameron
2015-06-21 12:53 ` [PATCH v2 1/2] iio: accel: STK8BA50: suspend sensor on init errors Jonathan Cameron

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.