summaryrefslogtreecommitdiff
path: root/sound/pci/hda/hda_codec.c
diff options
context:
space:
mode:
authorMark Brown <broonie@kernel.org>2019-09-09 16:55:20 +0300
committerMark Brown <broonie@kernel.org>2019-09-09 16:55:20 +0300
commitbb831786117519fc16dfd3eaa7b84e4f6bbb8d99 (patch)
tree18f8333bbaf6918a0246113eeb0f056011e436f2 /sound/pci/hda/hda_codec.c
parent6652ddbb5d83ecfc2591b92be063519714e40ebf (diff)
parent6fa5963c37a2e3335eba0b7455e35a01318ebc15 (diff)
downloadlinux-bb831786117519fc16dfd3eaa7b84e4f6bbb8d99.tar.xz
Merge branch 'asoc-5.4' into asoc-next
Diffstat (limited to 'sound/pci/hda/hda_codec.c')
-rw-r--r--sound/pci/hda/hda_codec.c8
1 files changed, 7 insertions, 1 deletions
diff --git a/sound/pci/hda/hda_codec.c b/sound/pci/hda/hda_codec.c
index 51f10ed9bc43..a2fb19129219 100644
--- a/sound/pci/hda/hda_codec.c
+++ b/sound/pci/hda/hda_codec.c
@@ -846,7 +846,13 @@ static void snd_hda_codec_dev_release(struct device *dev)
snd_hda_sysfs_clear(codec);
kfree(codec->modelname);
kfree(codec->wcaps);
- kfree(codec);
+
+ /*
+ * In the case of ASoC HD-audio, hda_codec is device managed.
+ * It will be freed when the ASoC device is removed.
+ */
+ if (codec->core.type == HDA_DEV_LEGACY)
+ kfree(codec);
}
#define DEV_NAME_LEN 31