From ee8829dc609c5c4a425b4a65fbb4cd56fb82f1f4 Mon Sep 17 00:00:00 2001 From: Bard Liao Date: Thu, 30 May 2019 04:59:00 +0800 Subject: ALSA: hda: fix: lock reg_lock before calling snd_hdac_bus_update_rirb The patch is to fix commit 5e13cf6cd64c (ALSA: hda: add polling mode in snd_hdac_bus_get_response) spin_lock_irq should be called before snd_hdac_bus_update_rirb. Fixes: 5e13cf6cd64c ("ALSA: hda: add polling mode in snd_hdac_bus_get_response") Signed-off-by: Bard Liao Signed-off-by: Takashi Iwai --- sound/hda/hdac_controller.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'sound/hda') diff --git a/sound/hda/hdac_controller.c b/sound/hda/hdac_controller.c index a16ac31bda83..d6a91429c058 100644 --- a/sound/hda/hdac_controller.c +++ b/sound/hda/hdac_controller.c @@ -239,9 +239,9 @@ int snd_hdac_bus_get_response(struct hdac_bus *bus, unsigned int addr, timeout = jiffies + msecs_to_jiffies(1000); for (loopcounter = 0;; loopcounter++) { + spin_lock_irq(&bus->reg_lock); if (bus->polling_mode) snd_hdac_bus_update_rirb(bus); - spin_lock_irq(&bus->reg_lock); if (!bus->rirb.cmds[addr]) { if (res) *res = bus->rirb.res[addr]; /* the last value */ -- cgit v1.2.3