Skip to content

Commit

Permalink
iio: light: pa12203001: Poweroff chip if register fails
Browse files Browse the repository at this point in the history
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>
  • Loading branch information
Adriana Reus authored and Jonathan Cameron committed Nov 8, 2015
1 parent a84ef0d commit 536bbca
Showing 1 changed file with 11 additions and 5 deletions.
16 changes: 11 additions & 5 deletions drivers/iio/light/pa12203001.c
Original file line number Diff line number Diff line change
@@ -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)

0 comments on commit 536bbca

Please sign in to comment.