regulator: gpio: Use dev_err_probe
PATCH 1/1 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.
---
Testing based on next-20250512 (includes additional patch) on AM62a7-sk
Before: https://gist.github.com/nmenon/be94f21e83b4260ad3f89e1ae8f0d188#file-before-L851
After: https://gist.github.com/nmenon/be94f21e83b4260ad3f89e1ae8f0d188#file-after-L806
drivers/regulator/gpio-regulator.c | 10 ++++------ 1 file changed, 4 insertions(+), 6 deletions(-)
drivers/regulator/gpio-regulator.c +4 -6
@@ -240,7 +240,7 @@ static int gpio_regulator_probe(struct platform_device *pdev)struct regulator_config cfg = { };struct regulator_dev *rdev;enum gpiod_flags gflags; -int ptr, ret, state, i; +int ptr, state, i; drvdata =devm_kzalloc (dev,sizeof (struct gpio_regulator_data ),GFP_KERNEL );
@@ -345,11 +345,9 @@ static int gpio_regulator_probe(struct platform_device *pdev)return PTR_ERR (cfg.ena_gpiod); rdev =devm_regulator_register (dev, &drvdata->desc, &cfg); -if (IS_ERR (rdev)) { - ret =PTR_ERR (rdev); -dev_err (dev,"Failed to register regulator: %d\n" , ret); -return ret; - } +if (IS_ERR (rdev)) +return dev_err_probe (dev,PTR_ERR (rdev), +"Failed to register regulator\n" );platform_set_drvdata (pdev, drvdata);
Signature · 1 line
2.47.0
Mark Brown
maintainerQuoted 8 lines · Nishanth Menon
During probe the gpio driver may not yet be available. Use
dev_err_probeto provide just the pertinent log.Since
dev_err_probetakes care of reporting the error value, drop the redundant ret variable while at it.[...]
Applied to
https://git.kernel.org/pub/scm/linux/kernel/git/broonie/regulator.git for-next
Thanks!
[1/1] regulator: gpio: Use dev_err_probe
commit: cad915e4515790d2e66525a86a166e7ce81e3055
All being well this means that it will be integrated into the linux-next tree (usually sometime in the next 24 hours) and sent to Linus during the next merge window (or sooner if it is a bug fix), however if problems are discovered then the patch may be dropped or reverted.
You may get further e-mails resulting from automated or manual testing and review of the tree, please engage with people reporting problems and send followup patches addressing any issues that are reported if needed.
If any updates are required or you are submitting further changes they should be sent as incremental updates against current git, existing patches will not be replaced.
Please add any relevant lists and maintainers to the CCs when replying to this mail.
Thanks,
Mark