ALSA: hda - Flush the pending probe work at remove
[firefly-linux-kernel-4.4.55.git] / sound / pci / hda / hda_intel.c
index 3b36582970702219f0e1b28f16093b4de6425b48..614baff1f5d7a915bd429405193c06b57f56548f 100644 (file)
@@ -2126,9 +2126,17 @@ i915_power_fail:
 static void azx_remove(struct pci_dev *pci)
 {
        struct snd_card *card = pci_get_drvdata(pci);
+       struct azx *chip;
+       struct hda_intel *hda;
+
+       if (card) {
+               /* flush the pending probing work */
+               chip = card->private_data;
+               hda = container_of(chip, struct hda_intel, chip);
+               flush_work(&hda->probe_work);
 
-       if (card)
                snd_card_free(card);
+       }
 }
 
 static void azx_shutdown(struct pci_dev *pci)