Bluetooth: drivers: h4: Fix uart_fifo_fill return value handling

The return value of uart_fifo_fill could potentially be negative, so
make sure the code doesn't do anything bad in that case.

Fixes #39823

Signed-off-by: Johan Hedberg <johan.hedberg@intel.com>
This commit is contained in:
Johan Hedberg 2021-10-28 20:08:13 +03:00 committed by Carles Cufí
commit 224468f35b

View file

@ -423,7 +423,11 @@ static inline void process_tx(void)
}
bytes = uart_fifo_fill(h4_dev, tx.buf->data, tx.buf->len);
net_buf_pull(tx.buf, bytes);
if (unlikely(bytes < 0)) {
BT_ERR("Unable to write to UART (err %d)", bytes);
} else {
net_buf_pull(tx.buf, bytes);
}
if (tx.buf->len) {
return;