power: regulator: common: use dm_gpio_is_valid helper

Use dm_gpio_is_valid() helper function instead of manually checking the
gpio.

Reviewed-by: Peng Fan <peng.fan@nxp.com>
Reviewed-by: Tanmay Kathpalia <tanmay.kathpalia@altera.com>
Reviewed-by: Neil Armstrong <neil.armstrong@linaro.org>
Signed-off-by: Julien Stephan <jstephan@baylibre.com>
Signed-off-by: Peng Fan <peng.fan@nxp.com>
This commit is contained in:
Julien Stephan
2026-01-15 15:30:44 +01:00
committed by Peng Fan
parent 7dbec4f77c
commit 0411cac161

View File

@@ -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);