summaryrefslogtreecommitdiffstats
path: root/drivers/regulator/stpmic1_regulator.c
diff options
context:
space:
mode:
authorMarco Felsch <m.felsch@pengutronix.de>2020-09-28 17:50:31 +0200
committerSascha Hauer <s.hauer@pengutronix.de>2020-09-29 10:28:42 +0200
commit158b18fddc816493e1f609fd00b6a5984435dd70 (patch)
treea6fa63fefa209db2ac279f98a3d291ae15ded2e8 /drivers/regulator/stpmic1_regulator.c
parent9fbad28fed2669c0d68e3c9853c36395b71e2d2a (diff)
downloadbarebox-158b18fddc816493e1f609fd00b6a5984435dd70.tar.gz
barebox-158b18fddc816493e1f609fd00b6a5984435dd70.tar.xz
regulator: stpmic1: fix registering missed regulators
The dts regulators subnode can be incomplete e.g. if the pre-programmed values are valid and shouldn't be changed. Missing regulator nodes are indicated by "of_regulator_match->of_node == NULL". Take missing regulators into account and register only existing ones. Signed-off-by: Marco Felsch <m.felsch@pengutronix.de> Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
Diffstat (limited to 'drivers/regulator/stpmic1_regulator.c')
-rw-r--r--drivers/regulator/stpmic1_regulator.c5
1 files changed, 5 insertions, 0 deletions
diff --git a/drivers/regulator/stpmic1_regulator.c b/drivers/regulator/stpmic1_regulator.c
index 71a4ae80c3..2b4b729541 100644
--- a/drivers/regulator/stpmic1_regulator.c
+++ b/drivers/regulator/stpmic1_regulator.c
@@ -383,6 +383,11 @@ static int stpmic1_regulator_register(struct device_d *dev, int id,
{
int ret;
+ if (!match->of_node) {
+ dev_dbg(dev, "Skip missing DTB regulator %s", match->name);
+ return 0;
+ }
+
cfg->dev = dev;
cfg->rdev.desc = &cfg->desc;
cfg->rdev.regmap = dev_get_regmap(dev->parent, NULL);