Unverified Commit 6430d65d authored by André Draszik's avatar André Draszik Committed by Mark Brown
Browse files

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: default avatarKrzysztof Kozlowski <krzysztof.kozlowski@linaro.org>
Signed-off-by: default avatarAndré Draszik <andre.draszik@linaro.org>
Link: https://patch.msgid.link/20260122-s2mpg1x-regulators-v7-12-3b1f9831fffd@linaro.org


Signed-off-by: default avatarMark Brown <broonie@kernel.org>
parent 0809d3dc
Loading
Loading
Loading
Loading
+14 −15
Original line number Diff line number Diff line
@@ -1249,9 +1249,9 @@ static int s2mps11_pmic_probe(struct platform_device *pdev)
		BUILD_BUG_ON(S2MPS_REGULATOR_MAX < ARRAY_SIZE(s2mpu05_regulators));
		break;
	default:
		dev_err(&pdev->dev, "Invalid device type: %u\n",
		return dev_err_probe(&pdev->dev, -ENODEV,
				     "Unsupported device type %d\n",
				     s2mps11->dev_type);
		return -EINVAL;
	}

	s2mps11->ext_control_gpiod = devm_kcalloc(&pdev->dev, rdev_num,
@@ -1290,21 +1290,20 @@ static int s2mps11_pmic_probe(struct platform_device *pdev)
			devm_gpiod_unhinge(&pdev->dev, config.ena_gpiod);
		regulator = devm_regulator_register(&pdev->dev,
						&regulators[i], &config);
		if (IS_ERR(regulator)) {
			dev_err(&pdev->dev, "regulator init failed for %d\n",
				i);
			return PTR_ERR(regulator);
		}
		if (IS_ERR(regulator))
			return dev_err_probe(&pdev->dev, PTR_ERR(regulator),
					     "regulator init failed for %d/%s\n",
					     regulators[i].id,
					     regulators[i].name);

		if (config.ena_gpiod) {
			ret = s2mps14_pmic_enable_ext_control(s2mps11,
							      regulator);
			if (ret < 0) {
				dev_err(&pdev->dev,
						"failed to enable GPIO control over %s: %d\n",
						regulator->desc->name, ret);
				return ret;
			}
			if (ret < 0)
				return dev_err_probe(&pdev->dev, ret,
						     "failed to enable GPIO control over %d/%s\n",
						     regulator->desc->id,
						     regulator->desc->name);
		}
	}