Skip to content

Commit 9b116ba

Browse files
Ciprian Marian Costeagroeck
authored andcommitted
hwmon: (ina2xx) make regulator 'vs' support optional
According to the 'ti,ina2xx' binding, the 'vs-supply' property is optional. Use devm_regulator_get_enable_optional() to avoid a kernel warning message if the property is not provided. Co-developed-by: Florin Buica <florin.buica@nxp.com> Tested-by: Enric Balletbo i Serra <eballetbo@kernel.org> Signed-off-by: Florin Buica <florin.buica@nxp.com> Signed-off-by: Ciprian Marian Costea <ciprianmarian.costea@oss.nxp.com> Link: https://lore.kernel.org/r/20250409074529.2233733-1-ciprianmarian.costea@oss.nxp.com [groeck: Use standard multi-line comment] Signed-off-by: Guenter Roeck <linux@roeck-us.net>
1 parent 0bf08f9 commit 9b116ba

1 file changed

Lines changed: 6 additions & 2 deletions

File tree

drivers/hwmon/ina2xx.c

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -959,8 +959,12 @@ static int ina2xx_probe(struct i2c_client *client)
959959
return PTR_ERR(data->regmap);
960960
}
961961

962-
ret = devm_regulator_get_enable(dev, "vs");
963-
if (ret)
962+
/*
963+
* Regulator core returns -ENODEV if the 'vs' is not available.
964+
* Hence the check for -ENODEV return code is necessary.
965+
*/
966+
ret = devm_regulator_get_enable_optional(dev, "vs");
967+
if (ret < 0 && ret != -ENODEV)
964968
return dev_err_probe(dev, ret, "failed to enable vs regulator\n");
965969

966970
ret = ina2xx_init(dev, data);

0 commit comments

Comments
 (0)