[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[Xen-devel] [PATCH] pl011: early_panic if baud rate not set in hardware



Now that the driver defaults to BAUD_AUTO this can happen if the early uart !=
console or if early printk isn't in use.

The following division by zero causes a trap but that uses regular printk and
not early_printk, so it is never seen.

Signed-off-by: Ian Campbell <ian.campbell@xxxxxxxxxx>
---
 xen/drivers/char/pl011.c |    2 ++
 1 files changed, 2 insertions(+), 0 deletions(-)

diff --git a/xen/drivers/char/pl011.c b/xen/drivers/char/pl011.c
index 0e1eb64..7eb90b0 100644
--- a/xen/drivers/char/pl011.c
+++ b/xen/drivers/char/pl011.c
@@ -104,6 +104,8 @@ static void __init pl011_init_preirq(struct serial_port 
*port)
     {
         /* Baud rate already set: read it out from the divisor latch. */
         divisor = (pl011_read(uart, IBRD) << 6) | (pl011_read(uart, FBRD));
+        if (!divisor)
+            early_panic("pl011: No Baud rate configured\n");
         uart->baud = (uart->clock_hz << 2) / divisor;
     }
     /* This write must follow FBRD and IBRD writes. */
-- 
1.7.2.5


_______________________________________________
Xen-devel mailing list
Xen-devel@xxxxxxxxxxxxx
http://lists.xen.org/xen-devel


 


Rackspace

Lists.xenproject.org is hosted with RackSpace, monitoring our
servers 24x7x365 and backed by RackSpace's Fanatical Support®.