Skip to content

Commit b9f91b3

Browse files
author
Marcus Chang
committed
Fix off-by-one error in NRF52 serial implementation
1 parent 18fa941 commit b9f91b3

File tree

1 file changed

+2
-1
lines changed

1 file changed

+2
-1
lines changed

targets/TARGET_NORDIC/TARGET_NRF5x/serial_api.c

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1104,7 +1104,8 @@ void serial_free(serial_t *obj)
11041104

11051105
int instance = uart_object->instance;
11061106

1107-
if (nordic_nrf5_uart_state[instance].usage_counter > 1) {
1107+
/* Only consider disabling UARTE if number of users is not zero. */
1108+
if (nordic_nrf5_uart_state[instance].usage_counter > 0) {
11081109

11091110
/* Decrement usage counter for this instance. */
11101111
nordic_nrf5_uart_state[instance].usage_counter--;

0 commit comments

Comments
 (0)