ASoC: codecs: wcd9335: Fix missing free of regulator supplies
authorKrzysztof Kozlowski <krzysztof.kozlowski@linaro.org>
Mon, 26 May 2025 09:47:01 +0000 (11:47 +0200)
committerMark Brown <broonie@kernel.org>
Tue, 27 May 2025 11:12:01 +0000 (12:12 +0100)
commit9079db287fc3e38e040b0edeb0a25770bb679c8e
treeda5f556bd25e20c9f74e210cec19468c090ce260
parentf4ba2ea57da51d616b689c4b8826c517ff5a8523
ASoC: codecs: wcd9335: Fix missing free of regulator supplies

Driver gets and enables all regulator supplies in probe path
(wcd9335_parse_dt() and wcd9335_power_on_reset()), but does not cleanup
in final error paths and in unbind (missing remove() callback).  This
leads to leaked memory and unbalanced regulator enable count during
probe errors or unbind.

Fix this by converting entire code into devm_regulator_bulk_get_enable()
which also greatly simplifies the code.

Fixes: 20aedafdf492 ("ASoC: wcd9335: add support to wcd9335 codec")
Cc: stable@vger.kernel.org
Signed-off-by: Krzysztof Kozlowski <krzysztof.kozlowski@linaro.org>
Link: https://patch.msgid.link/20250526-b4-b4-asoc-wcd9395-vdd-px-fixes-v1-1-0b8a2993b7d3@linaro.org
Signed-off-by: Mark Brown <broonie@kernel.org>
sound/soc/codecs/wcd9335.c