summaryrefslogtreecommitdiff
path: root/sound/soc/codecs/cs42l43.c
diff options
context:
space:
mode:
authorCharles Keepax <ckeepax@opensource.cirrus.com>2024-02-02 17:06:17 +0300
committerMark Brown <broonie@kernel.org>2024-02-05 17:32:24 +0300
commitcd2a2388614fcf2b9b626332c0da53a2c6cbf2ee (patch)
tree7453a155450ce3a3a15544e9645805d74ab3cf57 /sound/soc/codecs/cs42l43.c
parentb25c4e5684cd4e5a3528485918e34f04a4bea3e5 (diff)
downloadlinux-cd2a2388614fcf2b9b626332c0da53a2c6cbf2ee.tar.xz
ASoC: cs42l43: Add clear of stashed pointer on component remove
If the component is removed the stashed component pointer in the CODECs private struct should also be cleared to prevent use of a stale pointer. Signed-off-by: Charles Keepax <ckeepax@opensource.cirrus.com> Link: https://lore.kernel.org/r/20240202140619.1068560-1-ckeepax@opensource.cirrus.com Signed-off-by: Mark Brown <broonie@kernel.org>
Diffstat (limited to 'sound/soc/codecs/cs42l43.c')
-rw-r--r--sound/soc/codecs/cs42l43.c8
1 files changed, 8 insertions, 0 deletions
diff --git a/sound/soc/codecs/cs42l43.c b/sound/soc/codecs/cs42l43.c
index 2c402086924d..9e1deb3242cb 100644
--- a/sound/soc/codecs/cs42l43.c
+++ b/sound/soc/codecs/cs42l43.c
@@ -2111,10 +2111,18 @@ static int cs42l43_component_probe(struct snd_soc_component *component)
return 0;
}
+static void cs42l43_component_remove(struct snd_soc_component *component)
+{
+ struct cs42l43_codec *priv = snd_soc_component_get_drvdata(component);
+
+ priv->component = NULL;
+}
+
static const struct snd_soc_component_driver cs42l43_component_drv = {
.name = "cs42l43-codec",
.probe = cs42l43_component_probe,
+ .remove = cs42l43_component_remove,
.set_sysclk = cs42l43_set_sysclk,
.set_jack = cs42l43_set_jack,