[PATCH v2 4/5] ASoC: codecs: rt298: Set component to NULL on remove

Amadeusz Sławiński amadeuszx.slawinski at linux.intel.com
Thu Jul 7 14:57:00 CEST 2022


Make sure that component is set to proper value, otherwise we may
dereference freed component in interrupt.

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 | 1 +
 1 file changed, 1 insertion(+)

diff --git a/sound/soc/codecs/rt298.c b/sound/soc/codecs/rt298.c
index e1d94f128fd9..b0b53d4f07df 100644
--- a/sound/soc/codecs/rt298.c
+++ b/sound/soc/codecs/rt298.c
@@ -1022,6 +1022,7 @@ static void rt298_remove(struct snd_soc_component *component)
 	struct rt298_priv *rt298 = snd_soc_component_get_drvdata(component);
 
 	cancel_delayed_work_sync(&rt298->jack_detect_work);
+	rt298->component = NULL;
 }
 
 #ifdef CONFIG_PM
-- 
2.25.1



More information about the Alsa-devel mailing list