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:
parent
cc2d5f8a45
commit
224468f35b
1 changed files with 5 additions and 1 deletions
|
@ -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;
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue