[PATCH 10/11] ASoC: codecs: rt298: Fix NULL jack in interrupt
Amadeusz Sławiński
amadeuszx.slawinski at linux.intel.com
Thu Jun 9 15:35:40 CEST 2022
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.
Signed-off-by: Amadeusz Sławiński <amadeuszx.slawinski at linux.intel.com>
Reviewed-by: Cezary Rojewski <cezary.rojewski at intel.com>
---
sound/soc/codecs/rt298.c | 3 ++-
1 file changed, 2 insertions(+), 1 deletion(-)
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);
--
2.25.1
More information about the Alsa-devel
mailing list