Linux kernel mirror (for testing) git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
kernel os linux
1
fork

Configure Feed

Select the types of activity you want to include in your feed.

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>

authored by

Michael Tretter and committed by
Bartosz Golaszewski
09b174f1 36471374

+6 -9
+6 -9
drivers/regulator/bd71815-regulator.c
··· 571 571 return -ENODEV; 572 572 } 573 573 574 - ldo4_en = devm_fwnode_gpiod_get(&pdev->dev, 575 - dev_fwnode(pdev->dev.parent), 576 - "rohm,vsel", GPIOD_ASIS, "ldo4-en"); 577 - if (IS_ERR(ldo4_en)) { 578 - ret = PTR_ERR(ldo4_en); 579 - if (ret != -ENOENT) 580 - return ret; 581 - ldo4_en = NULL; 582 - } 574 + ldo4_en = devm_fwnode_gpiod_get_optional(&pdev->dev, 575 + dev_fwnode(pdev->dev.parent), 576 + "rohm,vsel", GPIOD_ASIS, 577 + "ldo4-en"); 578 + if (IS_ERR(ldo4_en)) 579 + return PTR_ERR(ldo4_en); 583 580 584 581 /* Disable to go to ship-mode */ 585 582 ret = regmap_update_bits(regmap, BD71815_REG_PWRCTRL, RESTARTEN, 0);