From da1cd59f35232dddec869a0c4793dbc2d5e8bb36 Mon Sep 17 00:00:00 2001 From: dulibo1 Date: Mon, 18 Sep 2023 19:14:11 +0800 Subject: [PATCH] regualtor:fix regulator_register check rpmsg regulator which leads to recursion Signed-off-by: dulibo1 --- drivers/power/supply/regulator.c | 16 ++++++++-------- 1 file changed, 8 insertions(+), 8 deletions(-) diff --git a/drivers/power/supply/regulator.c b/drivers/power/supply/regulator.c index 406c5e082c..b7781b1a25 100644 --- a/drivers/power/supply/regulator.c +++ b/drivers/power/supply/regulator.c @@ -217,14 +217,6 @@ static FAR struct regulator_dev_s *regulator_dev_lookup(const char *supply) } regulator_unlock(&g_reg_lock, flags); - -#if defined(CONFIG_REGULATOR_RPMSG) - if (rdev_found == NULL && strchr(supply, '/')) - { - rdev_found = regulator_rpmsg_get(supply); - } -#endif - return rdev_found; } @@ -569,6 +561,14 @@ FAR struct regulator_s *regulator_get(FAR const char *id) } rdev = regulator_dev_lookup(id); + +#if defined(CONFIG_REGULATOR_RPMSG) + if (rdev == NULL && strchr(id, '/')) + { + rdev = regulator_rpmsg_get(id); + } +#endif + if (rdev == NULL) { pwrerr("regulator %s not found\n", id);