aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorAlexey Charkov <alchark@flipper.net>2026-09-30 20:13:04 +0400
committerMark Brown <broonie@kernel.org>2026-10-04 18:29:12 +0200
commitb35ff7bd7dd56915a511eec56c8763ee8f9f7e9f (patch)
tree7d23a3aacdd5f76895cb300169ca6a703a5d8e12
parente2151c29cec73f6cc70abf1c7cbc7b9b202489f5 (diff)
regulator: of: state who owns the array from of_regulator_bulk_get_all()
of_regulator_bulk_get_all() allocates the consumer array and hands it to the caller, but never said so. Its own error path frees the array, while regulator_bulk_free() only puts the regulators, so both callers release the regulators and leak the array. Spell the contract out in the kerneldoc. Signed-off-by: Alexey Charkov <alchark@flipper.net> Link: https://patch.msgid.link/20260930-regulator-get-all-v2-2-ca82070d22f2@flipper.net Signed-off-by: Mark Brown <broonie@kernel.org>
-rw-r--r--drivers/regulator/of_regulator.c5
1 files changed, 5 insertions, 0 deletions
diff --git a/drivers/regulator/of_regulator.c b/drivers/regulator/of_regulator.c
index 785b7a11dfc6..09e26febfc83 100644
--- a/drivers/regulator/of_regulator.c
+++ b/drivers/regulator/of_regulator.c
@@ -929,6 +929,11 @@ static int is_supply_name(const char *name)
* before returning to the caller, and @consumers will not be
* changed.
*
+ * On success the array is allocated here and handed to the caller, which
+ * owns it from then on: release the regulators with regulator_bulk_free()
+ * and free the array itself with kfree(). The supply names live in the
+ * same allocation, so they are gone once the array is freed.
+ *
* Return: Number of regulators on success, or a negative error number
* on failure.
*/