summaryrefslogtreecommitdiffstats
path: root/drivers/iio/light
diff options
context:
space:
mode:
authorAdriana Reus <adriana.reus@intel.com>2015-11-06 11:10:37 +0200
committerJonathan Cameron <jic23@kernel.org>2015-11-08 15:34:40 +0000
commit536bbca7cfc9e7a85704de552fcf4b5d1062a38e (patch)
treecfaa05ac5ee3f61e9e3ddadf231e72096d9e881a /drivers/iio/light
parenta84ef0d181d917125f1f16cffe53f84c19968969 (diff)
downloadop-kernel-dev-536bbca7cfc9e7a85704de552fcf4b5d1062a38e.zip
op-kernel-dev-536bbca7cfc9e7a85704de552fcf4b5d1062a38e.tar.gz
iio: light: pa12203001: Poweroff chip if register fails
Make sure we poweroff the chip if for any reason iio_register returns an error. Signed-off-by: Adriana Reus <adriana.reus@intel.com> Signed-off-by: Jonathan Cameron <jic23@kernel.org>
Diffstat (limited to 'drivers/iio/light')
-rw-r--r--drivers/iio/light/pa12203001.c16
1 files changed, 11 insertions, 5 deletions
diff --git a/drivers/iio/light/pa12203001.c b/drivers/iio/light/pa12203001.c
index 45f7bde..76a9e12 100644
--- a/drivers/iio/light/pa12203001.c
+++ b/drivers/iio/light/pa12203001.c
@@ -381,17 +381,23 @@ static int pa12203001_probe(struct i2c_client *client,
return ret;
ret = pm_runtime_set_active(&client->dev);
- if (ret < 0) {
- pa12203001_power_chip(indio_dev, PA12203001_CHIP_DISABLE);
- return ret;
- }
+ if (ret < 0)
+ goto out_err;
pm_runtime_enable(&client->dev);
pm_runtime_set_autosuspend_delay(&client->dev,
PA12203001_SLEEP_DELAY_MS);
pm_runtime_use_autosuspend(&client->dev);
- return iio_device_register(indio_dev);
+ ret = iio_device_register(indio_dev);
+ if (ret < 0)
+ goto out_err;
+
+ return 0;
+
+out_err:
+ pa12203001_power_chip(indio_dev, PA12203001_CHIP_DISABLE);
+ return ret;
}
static int pa12203001_remove(struct i2c_client *client)
OpenPOWER on IntegriCloud