https://git.reactos.org/?p=reactos.git;a=commitdiff;h=48b3c61b5d6cddc20f322c40ddcc987f2a75ff1d

commit 48b3c61b5d6cddc20f322c40ddcc987f2a75ff1d
Author:     Victor Perevertkin <[email protected]>
AuthorDate: Tue Nov 3 23:18:14 2020 +0300
Commit:     Victor Perevertkin <[email protected]>
CommitDate: Tue Nov 3 23:18:14 2020 +0300

    [HDAUDBUS] Add a timeout into HDA_SendVerbs
    This function may stuck during device installation if there are issues
    with interrupts (or with a device itself).
    
    This fixes the boot on my testing ThinkPad x60s
---
 drivers/wdm/audio/hdaudbus/fdo.cpp | 19 ++++++++++++++-----
 1 file changed, 14 insertions(+), 5 deletions(-)

diff --git a/drivers/wdm/audio/hdaudbus/fdo.cpp 
b/drivers/wdm/audio/hdaudbus/fdo.cpp
index a600c64c7d8..2cb977eba29 100644
--- a/drivers/wdm/audio/hdaudbus/fdo.cpp
+++ b/drivers/wdm/audio/hdaudbus/fdo.cpp
@@ -176,11 +176,20 @@ HDA_SendVerbs(
 
     while (Queued--)
     {
-        KeWaitForSingleObject(&Codec->ResponseSemaphore,
-                              Executive,
-                              KernelMode,
-                              FALSE,
-                              NULL);
+        LARGE_INTEGER Timeout;
+        Timeout.QuadPart = -1000LL * 10000; // 1 sec
+
+        NTSTATUS waitStatus = KeWaitForSingleObject(&Codec->ResponseSemaphore,
+                                                    Executive,
+                                                    KernelMode,
+                                                    FALSE,
+                                                    &Timeout);
+
+        if (waitStatus == STATUS_TIMEOUT)
+        {
+            DPRINT1("HDA_SendVerbs: timeout! Queued: %u\n", Queued);
+            break;
+        }
     }
 
     if (Responses != NULL) {

Reply via email to