Message ID | 20220609133541.3984886-11-amadeuszx.slawinski@linux.intel.com |
---|---|
State | New |
Headers | show |
Series | ASoC: codecs: Series of fixes for realtek codecs used on RVPs | expand |
On Thu, Jun 09, 2022 at 03:35:40PM +0200, Amadeusz Sławiński wrote: > Set rt298->jack to passed value in mic_detect, otherwise when jack is > set to NULL on next interrupt call, we may use freed pointer. This is an actual fix so should go towards the start of the series, putting fixes at the start of the series avoids them getting spurious dependencies.
diff --git a/sound/soc/codecs/rt298.c b/sound/soc/codecs/rt298.c index 3c13b6dc3be9..2af037536bc9 100644 --- a/sound/soc/codecs/rt298.c +++ b/sound/soc/codecs/rt298.c @@ -336,6 +336,8 @@ static int rt298_mic_detect(struct snd_soc_component *component, bool mic = false; int status = 0; + rt298->jack = jack; + /* If jack in NULL, disable HS jack */ if (!jack) { disable_irq(rt298->i2c->irq); @@ -346,7 +348,6 @@ static int rt298_mic_detect(struct snd_soc_component *component, return 0; } - rt298->jack = jack; regmap_update_bits(rt298->regmap, RT298_IRQ_CTRL, 0x2, 0x2); enable_irq(rt298->i2c->irq);