Commit 5be59495 authored by Guenter Roeck's avatar Guenter Roeck Committed by Greg Kroah-Hartman

iio: max1363: Use devm_regulator_get_optional for optional regulator

commit 55b40d37 upstream.

In kernel version 3.13, devm_regulator_get() may return no error
if a regulator is undeclared. regulator_get_voltage() will return
-EINVAL if this happens. This causes the driver to fail loading if
the vref regulator is not declared.

Since vref is optional, call devm_regulator_get_optional instead.
Signed-off-by: default avatarGuenter Roeck <linux@roeck-us.net>
Signed-off-by: default avatarJonathan Cameron <jic23@kernel.org>
Signed-off-by: default avatarGreg Kroah-Hartman <gregkh@linuxfoundation.org>
parent aee63f4d
...@@ -1527,7 +1527,7 @@ static int max1363_probe(struct i2c_client *client, ...@@ -1527,7 +1527,7 @@ static int max1363_probe(struct i2c_client *client,
st->client = client; st->client = client;
st->vref_uv = st->chip_info->int_vref_mv * 1000; st->vref_uv = st->chip_info->int_vref_mv * 1000;
vref = devm_regulator_get(&client->dev, "vref"); vref = devm_regulator_get_optional(&client->dev, "vref");
if (!IS_ERR(vref)) { if (!IS_ERR(vref)) {
int vref_uv; int vref_uv;
......
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