This is an automated email from the ASF dual-hosted git repository.
xiaoxiang781216 pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/nuttx.git
The following commit(s) were added to refs/heads/master by this push:
new 49ad82fdbf8 power/regulator: remove redundant boot_on/always_on check
in register
49ad82fdbf8 is described below
commit 49ad82fdbf8152ab44fc483e22eb11ca1e33a12c
Author: anpeiyun <[email protected]>
AuthorDate: Thu Jul 2 17:27:43 2026 +0800
power/regulator: remove redundant boot_on/always_on check in register
The else-if branch in regulator_register already implicitly guarantees
that boot_on and always_on are both false (the preceding if checked
boot_on || always_on). The explicit !boot_on && !always_on test is
therefore always true and can be removed to simplify the condition.
Signed-off-by: anpeiyun <[email protected]>
---
drivers/power/supply/regulator.c | 3 +--
1 file changed, 1 insertion(+), 2 deletions(-)
diff --git a/drivers/power/supply/regulator.c b/drivers/power/supply/regulator.c
index d162712d3d7..62d6c998c25 100644
--- a/drivers/power/supply/regulator.c
+++ b/drivers/power/supply/regulator.c
@@ -1353,8 +1353,7 @@ regulator_register(FAR const struct regulator_desc_s
*regulator_desc,
goto out;
}
}
- else if (!rdev->desc->boot_on && !rdev->desc->always_on
- && _regulator_is_enabled(rdev))
+ else if (_regulator_is_enabled(rdev))
{
_regulator_do_disable(rdev);
}