ALSA: hda - Fix possible runtime PM refcount unbalance
When the driver is unloaded before the codec is bound, it still keeps
the runtime PM refcount up, and results in the unbalance. This patch
covers these cases by introducing a flag indicating the runtime PM
initialization and handling the codec registration procedure more
properly. It also fixes the missing input beep device as a gratis,
too.
Signed-off-by: Takashi Iwai <tiwai@suse.de>
diff --git a/sound/hda/hdac_device.c b/sound/hda/hdac_device.c
index aaece36..6e8ee1d 100644
--- a/sound/hda/hdac_device.c
+++ b/sound/hda/hdac_device.c
@@ -109,7 +109,6 @@
return 0;
error:
- pm_runtime_put_noidle(&codec->dev);
put_device(&codec->dev);
return err;
}
@@ -121,7 +120,7 @@
*/
void snd_hdac_device_exit(struct hdac_device *codec)
{
- /* pm_runtime_put_noidle(&codec->dev); */
+ pm_runtime_put_noidle(&codec->dev);
snd_hdac_bus_remove_device(codec->bus, codec);
kfree(codec->vendor_name);
kfree(codec->chip_name);