summaryrefslogtreecommitdiffstats
path: root/drivers
diff options
context:
space:
mode:
authorBrian Masney <masneyb@onstation.org>2018-05-10 20:12:17 -0400
committerJonathan Cameron <Jonathan.Cameron@huawei.com>2018-05-12 12:16:39 +0100
commitcc566e90cba70966b5c84ac373110d499b8be4ac (patch)
tree78ab78adaccd19684e49a86fa42bbe9d2b62ac9d /drivers
parent7b4db2e3e64a4a6028ff8cd1682df67df92a3ad4 (diff)
downloadlinux-cc566e90cba70966b5c84ac373110d499b8be4ac.tar.bz2
staging: iio: tsl2x7x: turn chip off if IIO device registration fails
This patch turns the chip off if IIO device registration fails so that the error handling mirrors the device remove to make review easier in preparation for moving this driver out of staging. This patch also adds a missing error check in the call to tsl2x7x_chip_on() in tsl2x7x_probe(). Signed-off-by: Brian Masney <masneyb@onstation.org> Signed-off-by: Jonathan Cameron <Jonathan.Cameron@huawei.com>
Diffstat (limited to 'drivers')
-rw-r--r--drivers/staging/iio/light/tsl2x7x.c5
1 files changed, 4 insertions, 1 deletions
diff --git a/drivers/staging/iio/light/tsl2x7x.c b/drivers/staging/iio/light/tsl2x7x.c
index c1e726fc87b7..f5ca5ada0358 100644
--- a/drivers/staging/iio/light/tsl2x7x.c
+++ b/drivers/staging/iio/light/tsl2x7x.c
@@ -1657,10 +1657,13 @@ static int tsl2x7x_probe(struct i2c_client *clientp,
}
tsl2x7x_defaults(chip);
- tsl2x7x_chip_on(indio_dev);
+ ret = tsl2x7x_chip_on(indio_dev);
+ if (ret < 0)
+ return ret;
ret = iio_device_register(indio_dev);
if (ret) {
+ tsl2x7x_chip_off(indio_dev);
dev_err(&clientp->dev,
"%s: iio registration failed\n", __func__);
return ret;