Commit 536bbca7 authored by Adriana Reus's avatar Adriana Reus Committed by Jonathan Cameron

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: default avatarAdriana Reus <adriana.reus@intel.com>
Signed-off-by: default avatarJonathan Cameron <jic23@kernel.org>
parent a84ef0d1
...@@ -381,17 +381,23 @@ static int pa12203001_probe(struct i2c_client *client, ...@@ -381,17 +381,23 @@ static int pa12203001_probe(struct i2c_client *client,
return ret; return ret;
ret = pm_runtime_set_active(&client->dev); ret = pm_runtime_set_active(&client->dev);
if (ret < 0) { if (ret < 0)
pa12203001_power_chip(indio_dev, PA12203001_CHIP_DISABLE); goto out_err;
return ret;
}
pm_runtime_enable(&client->dev); pm_runtime_enable(&client->dev);
pm_runtime_set_autosuspend_delay(&client->dev, pm_runtime_set_autosuspend_delay(&client->dev,
PA12203001_SLEEP_DELAY_MS); PA12203001_SLEEP_DELAY_MS);
pm_runtime_use_autosuspend(&client->dev); 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) static int pa12203001_remove(struct i2c_client *client)
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment