Re: [RFC PATCH 3/4] regulator: rts490x: Add driver for on-die regulators

From: Krzysztof Kozlowski

Date: Sun Sep 20 2026 - 09:06:00 EST


On 20/09/2026 12:05, zain_zhou@xxxxxxxxxxxxxx wrote:
> +
> + regulators = of_get_available_child_by_name(pdev->dev.of_node, "regulators");
> + if (!regulators)
> + return 0;
> +
> + config.dev = &pdev->dev;
> + config.regmap = rts490x->regmap;
> + config.driver_data = priv;
> +
> + for (i = 0; i < ARRAY_SIZE(rts490x_regulators); i++) {
> + struct device_node *node __free(device_node) = NULL;
> + const char *name = rts490x_regulators[i].of_match;
> +
> + node = of_get_available_child_by_name(regulators, name);
> + if (!node)
> + continue;
> +
> + config.of_node = node;
> + rdev = devm_regulator_register(&pdev->dev, &rts490x_regulators[i],
> + &config);
> + if (IS_ERR(rdev))

You leak OF nodes.

Best regards,
Krzysztof