ALSA: hda - fix use-after-free after module unload
[firefly-linux-kernel-4.4.55.git] / sound / pci / hda / hda_intel.c
index 03c34f65ceba931eafafc5efac0678d607a2bc45..873f5d1020ff7dea534ad2f9b69797268962c7d3 100644 (file)
@@ -1256,8 +1256,10 @@ static int azx_free(struct azx *chip)
        if (use_vga_switcheroo(hda)) {
                if (chip->disabled && hda->probe_continued)
                        snd_hda_unlock_devices(&chip->bus);
-               if (hda->vga_switcheroo_registered)
+               if (hda->vga_switcheroo_registered) {
                        vga_switcheroo_unregister_client(chip->pci);
+                       vga_switcheroo_fini_domain_pm_ops(chip->card->dev);
+               }
        }
 
        if (bus->chip_init) {