Fix off-by-one error in NRF52 serial implementation

pull/6547/head
Marcus Chang 2018-03-30 08:45:13 -07:00
parent 18fa9414cd
commit b9f91b3839
1 changed files with 2 additions and 1 deletions

View File

@ -1104,7 +1104,8 @@ void serial_free(serial_t *obj)
int instance = uart_object->instance;
if (nordic_nrf5_uart_state[instance].usage_counter > 1) {
/* Only consider disabling UARTE if number of users is not zero. */
if (nordic_nrf5_uart_state[instance].usage_counter > 0) {
/* Decrement usage counter for this instance. */
nordic_nrf5_uart_state[instance].usage_counter--;