From df7b80fecce977455a542e6a0a82a17e62521301 Mon Sep 17 00:00:00 2001
From: pwpiwi <pwpiwi@users.noreply.github.com>
Date: Thu, 6 Feb 2020 07:59:18 +0100
Subject: [PATCH 1/1] fix WaitForResponse (without timeout)

---
 client/comms.c | 3 +--
 1 file changed, 1 insertion(+), 2 deletions(-)

diff --git a/client/comms.c b/client/comms.c
index dcbd3ada..b3b85fd2 100644
--- a/client/comms.c
+++ b/client/comms.c
@@ -472,7 +472,6 @@ bool WaitForResponseTimeoutW(uint32_t cmd, UsbCommand* response, size_t ms_timeo
 	#endif
 
 	uint64_t start_time = msclock();
-	uint64_t end_time = start_time + ms_timeout;
 
 	if (response == NULL) {
 		response = &resp;
@@ -480,7 +479,7 @@ bool WaitForResponseTimeoutW(uint32_t cmd, UsbCommand* response, size_t ms_timeo
 
 	// Wait until the command is received
 	while (true) {
-		if (msclock() > end_time) {
+		if (ms_timeout != -1 && msclock() > start_time + ms_timeout) {
 			break; // timeout
 		}
 		if (msclock() - start_time > 2000 && show_warning) {
-- 
2.39.5