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: s2mps11: use dev_err_probe() where appropriate

dev_err_probe() exists to simplify code and harmonise error messages,
there's no reason not to use it here.

While at it, harmonise some error messages to add regulator name and ID
like in other messages in this driver, and update messages to be more
similar to other child-drivers of this PMIC (e.g. RTC).

Reviewed-by: Krzysztof Kozlowski <krzysztof.kozlowski@linaro.org>
Signed-off-by: André Draszik <andre.draszik@linaro.org>
Link: https://patch.msgid.link/20260122-s2mpg1x-regulators-v7-12-3b1f9831fffd@linaro.org
Signed-off-by: Mark Brown <broonie@kernel.org>

authored by

André Draszik and committed by
Mark Brown
6430d65d 0809d3dc

+14 -15
+14 -15
drivers/regulator/s2mps11.c
··· 1249 1249 BUILD_BUG_ON(S2MPS_REGULATOR_MAX < ARRAY_SIZE(s2mpu05_regulators)); 1250 1250 break; 1251 1251 default: 1252 - dev_err(&pdev->dev, "Invalid device type: %u\n", 1253 - s2mps11->dev_type); 1254 - return -EINVAL; 1252 + return dev_err_probe(&pdev->dev, -ENODEV, 1253 + "Unsupported device type %d\n", 1254 + s2mps11->dev_type); 1255 1255 } 1256 1256 1257 1257 s2mps11->ext_control_gpiod = devm_kcalloc(&pdev->dev, rdev_num, ··· 1290 1290 devm_gpiod_unhinge(&pdev->dev, config.ena_gpiod); 1291 1291 regulator = devm_regulator_register(&pdev->dev, 1292 1292 &regulators[i], &config); 1293 - if (IS_ERR(regulator)) { 1294 - dev_err(&pdev->dev, "regulator init failed for %d\n", 1295 - i); 1296 - return PTR_ERR(regulator); 1297 - } 1293 + if (IS_ERR(regulator)) 1294 + return dev_err_probe(&pdev->dev, PTR_ERR(regulator), 1295 + "regulator init failed for %d/%s\n", 1296 + regulators[i].id, 1297 + regulators[i].name); 1298 1298 1299 1299 if (config.ena_gpiod) { 1300 1300 ret = s2mps14_pmic_enable_ext_control(s2mps11, 1301 - regulator); 1302 - if (ret < 0) { 1303 - dev_err(&pdev->dev, 1304 - "failed to enable GPIO control over %s: %d\n", 1305 - regulator->desc->name, ret); 1306 - return ret; 1307 - } 1301 + regulator); 1302 + if (ret < 0) 1303 + return dev_err_probe(&pdev->dev, ret, 1304 + "failed to enable GPIO control over %d/%s\n", 1305 + regulator->desc->id, 1306 + regulator->desc->name); 1308 1307 } 1309 1308 } 1310 1309