Skip to content

Commit

Permalink
iio: max1363: Use devm_regulator_get_optional for optional regulator
Browse files Browse the repository at this point in the history
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: Guenter Roeck <linux@roeck-us.net>
Cc: Stable@vger.kernel.org
Signed-off-by: Jonathan Cameron <jic23@kernel.org>
  • Loading branch information
Guenter Roeck authored and Jonathan Cameron committed Feb 8, 2014
1 parent 5585215 commit 55b40d3
Showing 1 changed file with 1 addition and 1 deletion.
2 changes: 1 addition & 1 deletion drivers/iio/adc/max1363.c
Original file line number Diff line number Diff line change
Expand Up @@ -1560,7 +1560,7 @@ static int max1363_probe(struct i2c_client *client,
st->client = client;

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)) {
int vref_uv;

Expand Down

0 comments on commit 55b40d3

Please sign in to comment.