]> git.apps.os.sepia.ceph.com Git - ceph-client.git/commit
regulator: Fully clean up on error in of_regulator_bulk_get_all()
authorChen-Yu Tsai <wenst@chromium.org>
Thu, 22 Aug 2024 07:20:46 +0000 (15:20 +0800)
committerMark Brown <broonie@kernel.org>
Thu, 22 Aug 2024 12:34:30 +0000 (13:34 +0100)
commitbfefa214d179f13d01cf1b64a7efbabf586b0c49
treec50d04ecd0677f747a218317e5ff89c53abd9e0c
parent395a41a1d3e377462f3eea8a205ee72be8885ff6
regulator: Fully clean up on error in of_regulator_bulk_get_all()

Currently in of_regulator_bulk_get_all(), if any regulator request
fails, the error path releases all regulators already requested,
but leaves the |struct regulator_bulk_data| memory to the caller
to free, and also leaves the regulator consumer pointers dangling.
The latter behavior is not documented, and may not be what the
caller is expecting.

Instead, explicitly clean up everything on error, and make it clear
that the result pointer is only update if the whole request succeeds.

Signed-off-by: Chen-Yu Tsai <wenst@chromium.org>
Link: https://patch.msgid.link/20240822072047.3097740-4-wenst@chromium.org
Signed-off-by: Mark Brown <broonie@kernel.org>
drivers/regulator/of_regulator.c