Skip to content

Commit dddfad6

Browse files
committed
UART: Fix maybe-uninitialized diagnostic
The following error occurs when building with gcc 5.4.1 (debian stretch): common-hal/busio/UART.c:104:83: error: 'sercom_index' may be used uninitialized in this function [-Werror=maybe-uninitialized] sercom_insts[rx->sercom[j].index]->USART.CTRLA.bit.ENABLE == 0) || It may be related to the addition of rx-only UARTs; gcc is unable to infer the intended relationship between have_tx and sercom_index being set (I am still not entirely confident of it myself)
1 parent bf42611 commit dddfad6

File tree

1 file changed

+1
-1
lines changed
  • ports/atmel-samd/common-hal/busio

1 file changed

+1
-1
lines changed

ports/atmel-samd/common-hal/busio/UART.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -56,7 +56,7 @@ void common_hal_busio_uart_construct(busio_uart_obj_t *self,
5656
uint8_t bits, uart_parity_t parity, uint8_t stop, uint32_t timeout,
5757
uint8_t receiver_buffer_size) {
5858
Sercom* sercom = NULL;
59-
uint8_t sercom_index;
59+
uint8_t sercom_index = 255; // Unset index
6060
uint32_t rx_pinmux = 0;
6161
uint8_t rx_pad = 255; // Unset pad
6262
uint32_t tx_pinmux = 0;

0 commit comments

Comments
 (0)