This is an automated email from the ASF dual-hosted git repository. acassis pushed a commit to branch master in repository https://gitbox.apache.org/repos/asf/nuttx.git
commit da1cd59f35232dddec869a0c4793dbc2d5e8bb36 Author: dulibo1 <duli...@xiaomi.com> AuthorDate: Mon Sep 18 19:14:11 2023 +0800 regualtor:fix regulator_register check rpmsg regulator which leads to recursion Signed-off-by: dulibo1 <duli...@xiaomi.com> --- 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);