Skip to content

Commit 89b71b3

Browse files
digetxbroonie
authored andcommitted
ASoC: rt5640: Fix NULL dereference on module unload
The rt5640->jack is NULL if jack is already disabled at the time of driver's module unloading. Signed-off-by: Dmitry Osipenko <[email protected]> Link: https://lore.kernel.org/r/[email protected] Signed-off-by: Mark Brown <[email protected]>
1 parent ff3b574 commit 89b71b3

File tree

1 file changed

+7
-0
lines changed

1 file changed

+7
-0
lines changed

sound/soc/codecs/rt5640.c

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2432,6 +2432,13 @@ static void rt5640_disable_jack_detect(struct snd_soc_component *component)
24322432
{
24332433
struct rt5640_priv *rt5640 = snd_soc_component_get_drvdata(component);
24342434

2435+
/*
2436+
* soc_remove_component() force-disables jack and thus rt5640->jack
2437+
* could be NULL at the time of driver's module unloading.
2438+
*/
2439+
if (!rt5640->jack)
2440+
return;
2441+
24352442
disable_irq(rt5640->irq);
24362443
rt5640_cancel_work(rt5640);
24372444

0 commit comments

Comments
 (0)