Skip to contentSkip to conversation

ns16550 polling timeout sanity check

PATCH Alex Williamson 1 participant 1 message Dec 1, 2005

lore
Share & tools
lore
#0 lore raw

Hi Keir,

Here's a small sanity check fix for the recently added ns16550
polling support. If a device has a 1 byte tx fifo it's not hard for the integer math to end up with a 0 timeout. Default to a 1ms timeout if this happens. Thanks,

Alex

---

xen/drivers/char/ns16550.c +2 -0
diff -r f5b119533cc8 xen/drivers/char/ns16550.c
@@ -212,6 +212,8 @@
         /* Polled mode. Calculate time to fill RX FIFO and/or empty TX FIFO. */
         bits = uart->data_bits + uart->stop_bits + !!uart->parity;
         uart->timeout_ms = (bits * port->tx_fifo_size * 1000) / uart->baud;
+        if (!uart->timeout_ms)
+            uart->timeout_ms = 1;
         init_ac_timer(&uart->timer, ns16550_poll, port, 0);
         set_ac_timer(&uart->timer, NOW() + MILLISECS(uart->timeout_ms));
     }