From 71d84efc6a227ff5812561660dfcab454903cedb Mon Sep 17 00:00:00 2001 From: Xavier Chapron Date: Thu, 23 Apr 2020 16:03:55 +0200 Subject: [PATCH] logging: rtt: Fix RTT message dropped warning not displayed Fix data_out_block_mode() to return the data correctly sent to RTT. Before this fixes, it was always returning `lenght`, even in situation where data have been dropped. This was leading to not having the dropped messages warning displayed. Fixes #21514 Signed-off-by: Xavier Chapron --- subsys/logging/log_backend_rtt.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/subsys/logging/log_backend_rtt.c b/subsys/logging/log_backend_rtt.c index 65bcc7ee3df696..b788a444870d08 100644 --- a/subsys/logging/log_backend_rtt.c +++ b/subsys/logging/log_backend_rtt.c @@ -222,7 +222,7 @@ static int data_out_block_mode(uint8_t *data, size_t length, void *ctx) } } while ((ret == 0) && host_present); - return ((ret == 0) && host_present) ? 0 : length; + return ret ? length : 0; } LOG_OUTPUT_DEFINE(log_output, IS_ENABLED(CONFIG_LOG_BACKEND_RTT_MODE_BLOCK) ?