Unverified Commit 668f777d authored by Cristian Marussi's avatar Cristian Marussi Committed by Mark Brown
Browse files

regulator: scmi: Allow for zero voltage domains



SCMI Voltage protocol allows the platform to report no voltage domains
on discovery, while warning the user about such an odd configuration.
As a consequence this condition should not be treated as error by the SCMI
regulator driver either.

Allow SCMI regulator driver to probe successfully even when no voltage
domains are discovered.

Signed-off-by: default avatarCristian Marussi <cristian.marussi@arm.com>
Link: https://lore.kernel.org/r/20230126180511.766373-1-cristian.marussi@arm.com


Signed-off-by: default avatarMark Brown <broonie@kernel.org>
parent d5b4c8b9
Loading
Loading
Loading
Loading
+6 −10
Original line number Diff line number Diff line
@@ -311,16 +311,12 @@ static int scmi_regulator_probe(struct scmi_device *sdev)
		return PTR_ERR(voltage_ops);

	num_doms = voltage_ops->num_domains_get(ph);
	if (num_doms <= 0) {
		if (!num_doms) {
			dev_err(&sdev->dev,
				"number of voltage domains invalid\n");
			num_doms = -EINVAL;
		} else {
			dev_err(&sdev->dev,
				"failed to get voltage domains - err:%d\n",
	if (!num_doms)
		return 0;

	if (num_doms < 0) {
		dev_err(&sdev->dev, "failed to get voltage domains - err:%d\n",
			num_doms);
		}

		return num_doms;
	}