Re: [PATCH v5 3/3] regulator: Add regulator driver for Unisoc SC2730 PMIC

From: Uwe Kleine-König

Date: Fri Jun 19 2026 - 09:42:57 EST


Hello Otto,

On Fri, Jun 19, 2026 at 01:41:49PM +0200, Otto Pflüger wrote:
> +static int sc2730_regulator_probe(struct platform_device *pdev)
> +{
> + int i, ret;
> + struct regmap *regmap;
> + struct regulator_config config = { };
> + struct regulator_dev *rdev;
> +
> + regmap = dev_get_regmap(pdev->dev.parent, NULL);
> + if (!regmap) {
> + dev_err(&pdev->dev, "failed to get regmap.\n");
> + return -ENODEV;
> + }
> +
> + ret = sc2730_regulator_unlock(regmap);
> + if (ret) {
> + dev_err(&pdev->dev, "failed to release regulator lock\n");
> + return ret;
> + }

This can be shortend (and improved) to:

if (ret)
return dev_err_probe(&pdev->dev, ret, "failed to release regulator lock\n");

ditto for the other error messages in .probe().

> +
> + config.dev = pdev->dev.parent;
> + config.regmap = regmap;
> +
> + for (i = 0; i < ARRAY_SIZE(regulators); i++) {
> + rdev = devm_regulator_register(&pdev->dev, &regulators[i], &config);
> + if (IS_ERR(rdev)) {
> + dev_err(&pdev->dev, "failed to register regulator %s\n",
> + regulators[i].name);
> + return PTR_ERR(rdev);
> + }
> + }
> +
> + return 0;
> +}
> +
> +static const struct platform_device_id sc2730_regulator_id_table[] = {
> + { "sc2730-regulator" },

Please make this

{ .name = "sc2730-regulator" },

> + { }
> +};
> +MODULE_DEVICE_TABLE(platform, sc2730_regulator_id_table);

Best regards
Uwe

Attachment: signature.asc
Description: PGP signature