From: Guenter Roeck Date: Mon, 27 Jan 2014 18:10:00 +0000 (+0000) Subject: iio: max1363: Use devm_regulator_get_optional for optional regulator X-Git-Tag: submit/tizen_common/20140905.094502~679 X-Git-Url: http://review.tizen.org/git/?a=commitdiff_plain;h=5be594952c283412027639d60bc51116f64fdcbe;p=sdk%2Femulator%2Femulator-kernel.git iio: max1363: Use devm_regulator_get_optional for optional regulator commit 55b40d37311807a6bb2acdae0df904f54a0da3ae 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: Guenter Roeck Signed-off-by: Jonathan Cameron Signed-off-by: Greg Kroah-Hartman --- diff --git a/drivers/iio/adc/max1363.c b/drivers/iio/adc/max1363.c index 4fb35d1d7494..cfb3d39b6664 100644 --- a/drivers/iio/adc/max1363.c +++ b/drivers/iio/adc/max1363.c @@ -1527,7 +1527,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;