[PATCH] regulator: core: Fix resolve supply

From: Kory Maincent
Date: Wed Nov 13 2024 - 10:41:03 EST


The regulator should not use the device parent to resolve the regulator
supply. It fails to resolve the correct supply when the of_node
variable in the regulator_config structure is not within the parent
node.

Fixes: 6261b06de565 ("regulator: Defer lookup of supply to regulator_get")
Signed-off-by: Kory Maincent <kory.maincent@xxxxxxxxxxx>
---

It is weird that it wasn't seen before, maybe there was not any case
were it can't find the supply_name from the parent device.
---
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 76d3cd5ae6ea..ee5bc070b5bb 100644
--- a/drivers/regulator/core.c
+++ b/drivers/regulator/core.c
@@ -2023,7 +2023,7 @@ static struct regulator_dev *regulator_dev_lookup(struct device *dev,
static int regulator_resolve_supply(struct regulator_dev *rdev)
{
struct regulator_dev *r;
- struct device *dev = rdev->dev.parent;
+ struct device *dev = &rdev->dev;
struct ww_acquire_ctx ww_ctx;
int ret = 0;

--
2.34.1