Commit 9b116ba6 authored by Ciprian Marian Costea's avatar Ciprian Marian Costea Committed by Guenter Roeck
Browse files

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: default avatarFlorin Buica <florin.buica@nxp.com>
Tested-by: default avatarEnric Balletbo i Serra <eballetbo@kernel.org>
Signed-off-by: default avatarFlorin Buica <florin.buica@nxp.com>
Signed-off-by: default avatarCiprian 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: default avatarGuenter Roeck <linux@roeck-us.net>
parent 0bf08f9e
Loading
Loading
Loading
Loading
+6 −2
Original line number Diff line number Diff line
@@ -959,8 +959,12 @@ static int ina2xx_probe(struct i2c_client *client)
		return PTR_ERR(data->regmap);
	}

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

	ret = ina2xx_init(dev, data);