From ce40abcf21926b35da6c7255215c5062ac2be521 Mon Sep 17 00:00:00 2001 From: Damien George Date: Fri, 7 Feb 2020 12:55:12 +1100 Subject: [PATCH] stm32/usbd_cdc_interface: Remove "interrupt_char != -1" check. It's not needed. The C integer implicit promotion rules mean that the uint8_t of the incoming character is promoted to a (signed) int, matching the type of interrupt_char. Thus the uint8_t incoming character can never be equal to -1 (the value of interrupt_char that indicate that interruption is disabled). --- ports/stm32/usbd_cdc_interface.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/ports/stm32/usbd_cdc_interface.c b/ports/stm32/usbd_cdc_interface.c index 65f60e37c1..bdd7a4ec70 100644 --- a/ports/stm32/usbd_cdc_interface.c +++ b/ports/stm32/usbd_cdc_interface.c @@ -267,7 +267,7 @@ int8_t usbd_cdc_receive(usbd_cdc_state_t *cdc_in, size_t len) { // copy the incoming data into the circular buffer for (const uint8_t *src = cdc->rx_packet_buf, *top = cdc->rx_packet_buf + len; src < top; ++src) { - if (cdc->attached_to_repl && mp_interrupt_char != -1 && *src == mp_interrupt_char) { + if (cdc->attached_to_repl && *src == mp_interrupt_char) { pendsv_kbd_intr(); } else { uint16_t next_put = (cdc->rx_buf_put + 1) & (USBD_CDC_RX_DATA_SIZE - 1);