浏览代码

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>
Brian Masney 7 年之前
父节点
当前提交
cc566e90cb
共有 1 个文件被更改,包括 4 次插入1 次删除
  1. 4 1
      drivers/staging/iio/light/tsl2x7x.c

+ 4 - 1
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;