diff options
author | Dmitry Osipenko <digetx@gmail.com> | 2020-01-06 04:47:07 +0300 |
---|---|---|
committer | Greg Kroah-Hartman <gregkh@linuxfoundation.org> | 2020-02-05 17:43:43 +0300 |
commit | 38c78f918e8df9c2c4027ec9a9e95072ce934815 (patch) | |
tree | 422e163db13a487a2e6acf64bfc4c4ccb8650740 /sound | |
parent | 68229946d8f26824de30d57db4d966c57ad2ec21 (diff) | |
download | linux-38c78f918e8df9c2c4027ec9a9e95072ce934815.tar.xz |
ASoC: rt5640: Fix NULL dereference on module unload
[ Upstream commit 89b71b3f02d8ae5a08a1dd6f4a2098b7b868d498 ]
The rt5640->jack is NULL if jack is already disabled at the time of
driver's module unloading.
Signed-off-by: Dmitry Osipenko <digetx@gmail.com>
Link: https://lore.kernel.org/r/20200106014707.11378-1-digetx@gmail.com
Signed-off-by: Mark Brown <broonie@kernel.org>
Signed-off-by: Sasha Levin <sashal@kernel.org>
Diffstat (limited to 'sound')
-rw-r--r-- | sound/soc/codecs/rt5640.c | 7 |
1 files changed, 7 insertions, 0 deletions
diff --git a/sound/soc/codecs/rt5640.c b/sound/soc/codecs/rt5640.c index 27770143ae8f..974e1a449172 100644 --- a/sound/soc/codecs/rt5640.c +++ b/sound/soc/codecs/rt5640.c @@ -2435,6 +2435,13 @@ static void rt5640_disable_jack_detect(struct snd_soc_component *component) { struct rt5640_priv *rt5640 = snd_soc_component_get_drvdata(component); + /* + * soc_remove_component() force-disables jack and thus rt5640->jack + * could be NULL at the time of driver's module unloading. + */ + if (!rt5640->jack) + return; + disable_irq(rt5640->irq); rt5640_cancel_work(rt5640); |