[PATCH v1] ALSA: hda: fix snd_hda_bus_reset when single_cmd is not supported

From: soxiebing
Date: Tue Aug 20 2024 - 22:00:14 EST


From: songxiebing <songxiebing@xxxxxxxxxx>

When an azx_get_desponse timeout occurs, ensure that bus_reset
can be used when fallback_to_single_cmd is not supported.

Signed-off-by: songxiebing <songxiebing@xxxxxxxxxx>
---
sound/pci/hda/hda_controller.c | 8 ++++----
1 file changed, 4 insertions(+), 4 deletions(-)

diff --git a/sound/pci/hda/hda_controller.c b/sound/pci/hda/hda_controller.c
index 5d86e5a9c814..5ea198d67bda 100644
--- a/sound/pci/hda/hda_controller.c
+++ b/sound/pci/hda/hda_controller.c
@@ -809,10 +809,6 @@ static int azx_rirb_get_response(struct hdac_bus *bus, unsigned int addr,
return -EIO;
}

- /* no fallback mechanism? */
- if (!chip->fallback_to_single_cmd)
- return -EIO;
-
/* a fatal communication error; need either to reset or to fallback
* to the single_cmd mode
*/
@@ -824,6 +820,10 @@ static int azx_rirb_get_response(struct hdac_bus *bus, unsigned int addr,
return -EAGAIN; /* give a chance to retry */
}

+ /* no fallback mechanism? */
+ if (!chip->fallback_to_single_cmd)
+ return -EIO;
+
dev_err(chip->card->dev,
"azx_get_response timeout, switching to single_cmd mode: last cmd=0x%08x\n",
bus->last_cmd[addr]);
--
2.25.1