diff mbox series

ALSA: hda: fix: lock reg_lock before calling snd_hdac_bus_update_rirb

Message ID 20190529205900.26060-1-yung-chuan.liao@linux.intel.com (mailing list archive)
State New, archived
Headers show
Series ALSA: hda: fix: lock reg_lock before calling snd_hdac_bus_update_rirb | expand

Commit Message

Bard Liao May 29, 2019, 8:59 p.m. UTC
From: Bard Liao <yung-chuan.liao@linux.intel.com>

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.

Signed-off-by: Bard Liao <yung-chuan.liao@linux.intel.com>
---
Takashi,

Sorry, I make a mistake on the "ALSA: hda: add polling mode in
snd_hdac_bus_get_response" patch. This patch is a fix for that.

Thanks,
Bard
---
 sound/hda/hdac_controller.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

Comments

Takashi Iwai May 30, 2019, 9:02 a.m. UTC | #1
On Wed, 29 May 2019 22:59:00 +0200,
Bard liao wrote:
> 
> From: Bard Liao <yung-chuan.liao@linux.intel.com>
> 
> 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.
> 
> Signed-off-by: Bard Liao <yung-chuan.liao@linux.intel.com>
> ---
> Takashi,
> 
> Sorry, I make a mistake on the "ALSA: hda: add polling mode in
> snd_hdac_bus_get_response" patch. This patch is a fix for that.

A good catch, merged now.


thanks,

Takashi

> 
> Thanks,
> Bard
> ---
>  sound/hda/hdac_controller.c | 2 +-
>  1 file changed, 1 insertion(+), 1 deletion(-)
> 
> 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 */
> -- 
> 2.17.1
>
diff mbox series

Patch

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 */