From e1a7684a0f15cf180e95b4601cbe01a485ca5a6b Mon Sep 17 00:00:00 2001
From: Rahix <rahix@rahix.de>
Date: Wed, 21 Aug 2019 17:58:44 +0200
Subject: [PATCH] fix(cdcacm): Disable before printing error

Otherwise Epicardium attempts to print the error to cdcacm again,
leading to an endless recursion.

Signed-off-by: Rahix <rahix@rahix.de>
---
 epicardium/cdcacm.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/epicardium/cdcacm.c b/epicardium/cdcacm.c
index 4a49ba9c..04c16bd8 100644
--- a/epicardium/cdcacm.c
+++ b/epicardium/cdcacm.c
@@ -207,8 +207,8 @@ void cdcacm_write(uint8_t *data, int len)
 	if (acm_present() && !lockup_disable) {
 		int ret = acm_write(data, len);
 		if (ret < 0) {
-			LOG_ERR("cdcacm", "fifo lockup detected");
 			lockup_disable = 1;
+			LOG_ERR("cdcacm", "fifo lockup detected");
 		} else if (ret != len) {
 			LOG_WARN(
 				"cdcacm", "write length mismatch, got %d", ret
-- 
GitLab