Skip to content

Commit 798590c

Browse files
jhovoldbroonie
authored andcommitted
ASoC: codecs: wcd934x: fix resource leaks on component remove
Make sure to release allocated MBHC resources also on component remove. This is specifically needed to allow probe deferrals of the sound card which otherwise fails when reprobing the codec component. Fixes: 9fb9b16 ("ASoC: codecs: wcd934x: add mbhc support") Cc: stable@vger.kernel.org # 5.14 Cc: Srinivas Kandagatla <srinivas.kandagatla@linaro.org> Signed-off-by: Johan Hovold <johan+linaro@kernel.org> Reviewed-by: Srinivas Kandagatla <srinivas.kandagatla@linaro.org> Link: https://lore.kernel.org/r/20230705123018.30903-6-johan+linaro@kernel.org Signed-off-by: Mark Brown <broonie@kernel.org>
1 parent a3406f8 commit 798590c

1 file changed

Lines changed: 12 additions & 0 deletions

File tree

sound/soc/codecs/wcd934x.c

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -3044,6 +3044,17 @@ static int wcd934x_mbhc_init(struct snd_soc_component *component)
30443044

30453045
return 0;
30463046
}
3047+
3048+
static void wcd934x_mbhc_deinit(struct snd_soc_component *component)
3049+
{
3050+
struct wcd934x_codec *wcd = snd_soc_component_get_drvdata(component);
3051+
3052+
if (!wcd->mbhc)
3053+
return;
3054+
3055+
wcd_mbhc_deinit(wcd->mbhc);
3056+
}
3057+
30473058
static int wcd934x_comp_probe(struct snd_soc_component *component)
30483059
{
30493060
struct wcd934x_codec *wcd = dev_get_drvdata(component->dev);
@@ -3077,6 +3088,7 @@ static void wcd934x_comp_remove(struct snd_soc_component *comp)
30773088
{
30783089
struct wcd934x_codec *wcd = dev_get_drvdata(comp->dev);
30793090

3091+
wcd934x_mbhc_deinit(comp);
30803092
wcd_clsh_ctrl_free(wcd->clsh_ctrl);
30813093
}
30823094

0 commit comments

Comments
 (0)