Added flush_scheduled_work() in snd_hda_codec_free() to make sure that
the all work is gone.  Also, optimized the condition to schedule the
delayed work in snd_hda_power_down().
Signed-off-by: Takashi Iwai <tiwai@suse.de>
Signed-off-by: Jaroslav Kysela <perex@suse.cz>
                return;
 #ifdef CONFIG_SND_HDA_POWER_SAVE
        cancel_delayed_work(&codec->power_work);
+       flush_scheduled_work();
 #endif
        list_del(&codec->list);
        codec->bus->caddr_tbl[codec->addr] = NULL;
 void snd_hda_power_down(struct hda_codec *codec)
 {
        --codec->power_count;
-       if (!codec->power_on)
+       if (!codec->power_on || codec->power_count)
                return;
        if (power_save)
                schedule_delayed_work(&codec->power_work,