[PATCH v2 0/2] regulator: of: Fixes to of_regulator_bulk_get_all()

From: Alexey Charkov

Date: Wed Sep 30 2026 - 13:01:23 EST


of_regulator_bulk_get_all() only fills in the .consumer part of the
struct regulator_bulk_data for the regulators it gets, leaving .supply as
garbage, while the rest of the regulator core expects a meaningful name
there (e.g. for error prints), causing uninitialized memory access in any
failure paths in the core.

It also allocates the supplies array and hands it to callers, but never
says the callers need to free it (which they don't currently), causing
leaks.

Fix the former and document the latter in the kerneldoc to help any new
users avoid the leak.

Signed-off-by: Alexey Charkov <alchark@xxxxxxxxxxx>
---
Changes in v2:
- Split by subsystem for easier application, per Mark's feedback
- Link to v1: https://patch.msgid.link/20260929-regulator-get-all-v1-0-e887c66a47f1@xxxxxxxxxxx

To: Liam Girdwood <lgirdwood@xxxxxxxxx>
To: Mark Brown <broonie@xxxxxxxxxx>
To: Corentin Labbe <clabbe@xxxxxxxxxxxx>
Cc: linux-kernel@xxxxxxxxxxxxxxx

---
Alexey Charkov (2):
regulator: of: fill in supply names in of_regulator_bulk_get_all()
regulator: of: state who owns the array from of_regulator_bulk_get_all()

drivers/regulator/of_regulator.c | 29 ++++++++++++++++++++++-------
1 file changed, 22 insertions(+), 7 deletions(-)
---
base-commit: 6c2cb8b8b843d216ab549b678a0d8831c43153e0
change-id: 20260929-regulator-get-all-a553e73ff1ce

Best regards,
--
Alexey Charkov <alchark@xxxxxxxxxxx>