summaryrefslogtreecommitdiffstats
path: root/drivers/regulator/core.c
diff options
context:
space:
mode:
authorAhmad Fatoum <a.fatoum@pengutronix.de>2022-12-01 14:38:53 +0100
committerSascha Hauer <s.hauer@pengutronix.de>2022-12-02 09:53:43 +0100
commit479b76cda87adb3b4220901552fc93f3fb794c9c (patch)
tree2242f80734fc6a2774a66a41b82c037248e29949 /drivers/regulator/core.c
parente57efd93206d3f7b1ff6c003bf1ff31d5063e914 (diff)
downloadbarebox-479b76cda87adb3b4220901552fc93f3fb794c9c.tar.gz
barebox-479b76cda87adb3b4220901552fc93f3fb794c9c.tar.xz
regulator: core: don't call of_regulator_get with NULL argument
regulator_get calls either of_regulator_get or dev_regulator_get, both of which accept a supply parameter. Only dev_regulator_get gracefully handles a NULL supply by considering all registered regulators. of_regulator_get on the other hand, will complain at debug level, before returning NULL: uart-pl011 fe201000.serial@7e201000.of: No <NULL>-supply node found, using dummy regulator Avoid this message by skipping of_regulator_get if no supply was found and directly call dev_regulator_get. Signed-off-by: Ahmad Fatoum <a.fatoum@pengutronix.de> Reviewed-by: Marco Felsch <m.felsch@pengutronix.de> Link: https://lore.barebox.org/20221201133853.639287-1-a.fatoum@pengutronix.de Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
Diffstat (limited to 'drivers/regulator/core.c')
-rw-r--r--drivers/regulator/core.c2
1 files changed, 1 insertions, 1 deletions
diff --git a/drivers/regulator/core.c b/drivers/regulator/core.c
index 4876f0f44b..d25aba38c3 100644
--- a/drivers/regulator/core.c
+++ b/drivers/regulator/core.c
@@ -388,7 +388,7 @@ struct regulator *regulator_get(struct device_d *dev, const char *supply)
struct regulator *r;
int ret;
- if (dev->device_node) {
+ if (dev->device_node && supply) {
ri = of_regulator_get(dev, supply);
if (IS_ERR(ri))
return ERR_CAST(ri);