]> git.ipfire.org Git - thirdparty/kernel/linux.git/commitdiff
regulator: bd71815: switch to devm_fwnode_gpiod_get_optional
authorMichael Tretter <m.tretter@pengutronix.de>
Mon, 26 Jan 2026 14:27:48 +0000 (15:27 +0100)
committerBartosz Golaszewski <bartosz.golaszewski@oss.qualcomm.com>
Tue, 27 Jan 2026 09:13:37 +0000 (10:13 +0100)
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>
drivers/regulator/bd71815-regulator.c

index 8da57a7bb2f1bf70d3337c9465ab1ef7a2ae1fa8..668714f35464cedda5c0bfa4613b75ef70098b8d 100644 (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);