Re: [PATCH v3 2/3] regulator: max77675: Add MAX77675 regulator driver

From: Krzysztof Kozlowski

Date: Tue Oct 14 2025 - 04:17:30 EST


On 14/10/2025 07:31, Joan-Na-adi wrote:
> From: Joan Na <joan.na@xxxxxxxxxx>
>
> This patch adds support for the Maxim Integrated MAX77675 PMIC regulator.


Please do not use "This commit/patch/change", but imperative mood. See
longer explanation here:
https://elixir.bootlin.com/linux/v6.16/source/Documentation/process/submitting-patches.rst#L94

...

> + config.dev = &client->dev;
> + config.regmap = maxreg->regmap;
> + config.driver_data = maxreg;
> +
> + regulators_np = of_get_child_by_name(client->dev.of_node, "regulators");


Where do you drop this reference?


> + if (!regulators_np) {
> + dev_err(maxreg->dev, "No 'regulators' subnode found in DT\n");
> + return -EINVAL;
> + }
> +
> + for (i = 0; i < MAX77675_ID_NUM_MAX; i++) {
> + const struct regulator_desc *desc = &max77675_regulators[i];
> + struct regulator_dev *rdev;
> + struct device_node *child_np;
> +
> + child_np = of_get_child_by_name(regulators_np, desc->name);
> + if (!child_np) {
> + dev_warn(maxreg->dev, "No DT node for regulator %s\n", desc->name);
> + continue;
> + }
> +
> + config.of_node = child_np;
> +
> + rdev = devm_regulator_register(&client->dev, desc, &config);


Can't you drop child_np reference here?

> + if (IS_ERR(rdev)) {
> + ret = PTR_ERR(rdev);
> + dev_err(maxreg->dev,
> + "Failed to register regulator %d (%s): %d\n",
> + i, desc->name, ret);
> + of_node_put(child_np);
> + return ret;


return dev_err_probe

> + }
> + of_node_put(child_np);
> + }
> +
> + i2c_set_clientdata(client, maxreg);
> +
> + return 0;
> +}
> +
> +static void max77675_regulator_remove(struct i2c_client *client)
> +{
> + /* Nothing to clean up currently */


So drop it, do not add dead code.

> +}
> +
> +static const struct i2c_device_id max77675_i2c_id[] = {
> + { "max77675", 0 },
> + { }
Best regards,
Krzysztof