[PATCH] regulator: core: don't call of_regulator_get with NULL argument

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



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@xxxxxxxxxxx: 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@xxxxxxxxxxxxxx>
---
 drivers/regulator/core.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/drivers/regulator/core.c b/drivers/regulator/core.c
index 4876f0f44bdd..d25aba38c3e2 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);
-- 
2.30.2





[Index of Archives]     [Linux Embedded]     [Linux USB Devel]     [Linux Audio Users]     [Yosemite News]     [Linux Kernel]     [Linux SCSI]     [XFree86]

  Powered by Linux