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: 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>

authored by

Nishanth Menon and committed by
Mark Brown
cad915e4 6157e62b

+4 -6
+4 -6
drivers/regulator/gpio-regulator.c
··· 240 240 struct regulator_config cfg = { }; 241 241 struct regulator_dev *rdev; 242 242 enum gpiod_flags gflags; 243 - int ptr, ret, state, i; 243 + int ptr, state, i; 244 244 245 245 drvdata = devm_kzalloc(dev, sizeof(struct gpio_regulator_data), 246 246 GFP_KERNEL); ··· 345 345 return PTR_ERR(cfg.ena_gpiod); 346 346 347 347 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"); 353 351 354 352 platform_set_drvdata(pdev, drvdata); 355 353