mirror of
https://github.com/torvalds/linux.git
synced 2026-10-23 23:51:02 +02:00
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>
This commit is contained in:
parent
e2151c29ce
commit
b35ff7bd7d
|
|
@ -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.
|
||||
*/
|
||||
|
|
|
|||
Loading…
Reference in New Issue
Block a user