[PATCH v3 2/3] power: regulator: common: use dm_gpio_is_valid helper
Julien Stephan
jstephan at baylibre.com
Thu Jan 15 15:30:44 CET 2026
Use dm_gpio_is_valid() helper function instead of manually checking the
gpio.
Reviewed-by: Peng Fan <peng.fan at nxp.com>
Reviewed-by: Tanmay Kathpalia <tanmay.kathpalia at altera.com>
Reviewed-by: Neil Armstrong <neil.armstrong at linaro.org>
Signed-off-by: Julien Stephan <jstephan at baylibre.com>
---
drivers/power/regulator/regulator_common.c | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/drivers/power/regulator/regulator_common.c b/drivers/power/regulator/regulator_common.c
index ce3d80670de..cf98998579a 100644
--- a/drivers/power/regulator/regulator_common.c
+++ b/drivers/power/regulator/regulator_common.c
@@ -51,7 +51,7 @@ int regulator_common_get_enable(const struct udevice *dev,
struct regulator_common_plat *plat)
{
/* Enable GPIO is optional */
- if (!plat->gpio.dev)
+ if (!dm_gpio_is_valid(&plat->gpio))
return true;
return dm_gpio_get_value(&plat->gpio);
--
2.52.0
More information about the U-Boot
mailing list