Skip to content

Commit cad915e

Browse files
nmenonbroonie
authored andcommitted
regulator: gpio: Use dev_err_probe
During probe the gpio driver may not yet be available. Use dev_err_probe to provide just the pertinent log. Since dev_err_probe takes care of reporting the error value, drop the redundant ret variable while at it. Signed-off-by: Nishanth Menon <nm@ti.com> Link: https://patch.msgid.link/20250512185727.2907411-1-nm@ti.com Signed-off-by: Mark Brown <broonie@kernel.org>
1 parent 6157e62 commit cad915e

File tree

1 file changed

+4
-6
lines changed

1 file changed

+4
-6
lines changed

drivers/regulator/gpio-regulator.c

Lines changed: 4 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -240,7 +240,7 @@ static int gpio_regulator_probe(struct platform_device *pdev)
240240
struct regulator_config cfg = { };
241241
struct regulator_dev *rdev;
242242
enum gpiod_flags gflags;
243-
int ptr, ret, state, i;
243+
int ptr, state, i;
244244

245245
drvdata = devm_kzalloc(dev, sizeof(struct gpio_regulator_data),
246246
GFP_KERNEL);
@@ -345,11 +345,9 @@ static int gpio_regulator_probe(struct platform_device *pdev)
345345
return PTR_ERR(cfg.ena_gpiod);
346346

347347
rdev = devm_regulator_register(dev, &drvdata->desc, &cfg);
348-
if (IS_ERR(rdev)) {
349-
ret = PTR_ERR(rdev);
350-
dev_err(dev, "Failed to register regulator: %d\n", ret);
351-
return ret;
352-
}
348+
if (IS_ERR(rdev))
349+
return dev_err_probe(dev, PTR_ERR(rdev),
350+
"Failed to register regulator\n");
353351

354352
platform_set_drvdata(pdev, drvdata);
355353

0 commit comments

Comments
 (0)