ASoC: codecs: arizona-jack: Balance MICVDD and runtime PM on MICD errors
Subsystems (3)
PATCH 1/1 ASoC: codecs: arizona-jack: Balance MICVDD and runtime PM on MICD errors
arizona_start_mic() takes a runtime PM reference and enables MICVDD before enabling microphone detection. If regmap_update_bits_check() fails, it only reports the error and leaves both references held.
A later arizona_stop_mic() only releases them when clearing ARIZONA_MICD_ENA changes the register. An error before MICD is enabled therefore keeps the device active and MICVDD enabled indefinitely.
Release MICVDD and the runtime PM reference on error, just as for a successful update which reports no change.
This issue was found by a static analysis checker and confirmed by manual source review.
Fixes fbdc60b2a787 ("extcon: arizona: Correct error handling on regmap_update_bits_check")
Signed-off-by Ruoyu Wang <[email protected]>
--- sound/soc/codecs/arizona-jack.c | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-)
sound/soc/codecs/arizona-jack.c +3 -2
@@ -272,9 +272,10 @@ static void arizona_start_mic(struct arizona_priv *info) ret =regmap_update_bits_check (arizona->regmap,ARIZONA_MIC_DETECT_1 ,ARIZONA_MICD_ENA ,ARIZONA_MICD_ENA , &change); -if (ret <0 ) { +if (ret <0 )dev_err (arizona->dev,"Failed to enable micd: %d\n" , ret); - }else if (!change) { + +if (ret <0 || !change) {regulator_disable (info->micvdd);pm_runtime_put_autosuspend (arizona->dev); }
Signature · 1 line
2.51.0