From a457782a1c694c5c84dac55c9a77789dd741a7e5 Mon Sep 17 00:00:00 2001 From: Takashi Iwai Date: Thu, 11 Jun 2015 14:02:49 +0200 Subject: [PATCH] ALSA: hda - Fix link power unbalance at device removal snd_hdac_link_power() has to be called after unregistering the codec device. Otherwise the device might be already runtime-suspended, thus the refcount goes under zero, triggering a warning like: WARNING: CPU: 7 PID: 2014 at sound/hda/hdac_i915.c:63 snd_hdac_display_power+0x106/0x120 [snd_hda_core]() CPU: 7 PID: 2014 Comm: modprobe Not tainted 4.1.0-rc7-test+ #1 Call Trace: [] dump_stack+0x4c/0x6e [] warn_slowpath_common+0x8a/0xc0 [] warn_slowpath_null+0x1a/0x20 [] snd_hdac_display_power+0x106/0x120 [snd_hda_core] [] azx_intel_link_power+0x12/0x20 [snd_hda_intel] [] azx_link_power+0x1f/0x30 [snd_hda_codec] [] snd_hdac_link_power+0x2e/0x40 [snd_hda_core] [] snd_hda_codec_dev_free+0x34/0x50 [snd_hda_codec] [] __snd_device_free+0x51/0xa0 [snd] ..... Signed-off-by: Takashi Iwai --- sound/pci/hda/hda_codec.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/sound/pci/hda/hda_codec.c b/sound/pci/hda/hda_codec.c index d70229841156..497bd0f9dcda 100644 --- a/sound/pci/hda/hda_codec.c +++ b/sound/pci/hda/hda_codec.c @@ -886,8 +886,8 @@ static int snd_hda_codec_dev_free(struct snd_device *device) struct hda_codec *codec = device->device_data; codec->in_freeing = 1; - snd_hdac_link_power(&codec->core, false); snd_hdac_device_unregister(&codec->core); + snd_hdac_link_power(&codec->core, false); put_device(hda_codec_dev(codec)); return 0; } -- 2.25.1