On Fri, Sep 12, 2025 at 2:08 AM <frank.chang@sifive.com> wrote:
>
> From: Frank Chang <frank.chang@sifive.com>
>
> There's no need to call fifo8_push_all() when size is zero.
>
> Signed-off-by: Frank Chang <frank.chang@sifive.com>
Reviewed-by: Alistair Francis <alistair.francis@wdc.com>
Alistair
> ---
> hw/char/sifive_uart.c | 4 +++-
> 1 file changed, 3 insertions(+), 1 deletion(-)
>
> diff --git a/hw/char/sifive_uart.c b/hw/char/sifive_uart.c
> index 138c31fcabf..401f869680d 100644
> --- a/hw/char/sifive_uart.c
> +++ b/hw/char/sifive_uart.c
> @@ -122,7 +122,9 @@ static void sifive_uart_write_tx_fifo(SiFiveUARTState *s, const uint8_t *buf,
> qemu_log_mask(LOG_GUEST_ERROR, "sifive_uart: TX FIFO overflow");
> }
>
> - fifo8_push_all(&s->tx_fifo, buf, size);
> + if (size > 0) {
> + fifo8_push_all(&s->tx_fifo, buf, size);
> + }
>
> if (fifo8_is_full(&s->tx_fifo)) {
> s->txfifo |= SIFIVE_UART_TXFIFO_FULL;
> --
> 2.49.0
>
>