regulator: bd71815: switch to devm_fwnode_gpiod_get_optional

Use the devm_fwnode_gpiod_get_optional variant to simplify the error
handling code.

Reviewed-by: Matti Vaittinen <mazziesaccount@gmail.com>
Acked-by: Mark Brown <broonie@kernel.org>
Signed-off-by: Michael Tretter <m.tretter@pengutronix.de>
Link: https://lore.kernel.org/r/20260126-gpio-devm_fwnode_gpiod_get_optional-v2-2-ec34f8e35077@pengutronix.de
Signed-off-by: Bartosz Golaszewski <bartosz.golaszewski@oss.qualcomm.com>
This commit is contained in:
Michael Tretter 2026-01-26 15:27:48 +01:00 committed by Bartosz Golaszewski
parent 364713741c
commit 09b174f1a5

View file

@ -571,15 +571,12 @@ static int bd7181x_probe(struct platform_device *pdev)
return -ENODEV;
}
ldo4_en = devm_fwnode_gpiod_get(&pdev->dev,
dev_fwnode(pdev->dev.parent),
"rohm,vsel", GPIOD_ASIS, "ldo4-en");
if (IS_ERR(ldo4_en)) {
ret = PTR_ERR(ldo4_en);
if (ret != -ENOENT)
return ret;
ldo4_en = NULL;
}
ldo4_en = devm_fwnode_gpiod_get_optional(&pdev->dev,
dev_fwnode(pdev->dev.parent),
"rohm,vsel", GPIOD_ASIS,
"ldo4-en");
if (IS_ERR(ldo4_en))
return PTR_ERR(ldo4_en);
/* Disable to go to ship-mode */
ret = regmap_update_bits(regmap, BD71815_REG_PWRCTRL, RESTARTEN, 0);