]> git.karo-electronics.de Git - linux-beck.git/commitdiff
OMAP3: serial: Check for zero-based physical addr
authorSergio Aguirre <saaguirre@ti.com>
Sat, 27 Feb 2010 20:13:43 +0000 (14:13 -0600)
committerSergio Aguirre <saaguirre@ti.com>
Mon, 15 Mar 2010 21:33:31 +0000 (16:33 -0500)
This is for protecting a wrong mapping attempt of a zero-based
physical address.

The result is that, no serial port will be attempted to be mapped.

Also add an additional protection for NULL clocks before attempting
to enable them (if above condition applies)

Signed-off-by: Sergio Aguirre <saaguirre@ti.com>
arch/arm/mach-omap2/serial.c

index da77930480e9a6f696546d820864d55de9a42168..ef91fc0390b4be5de788866f7293cfc3133775ab 100644 (file)
@@ -664,6 +664,12 @@ void __init omap_serial_early_init(void)
                struct device *dev = &pdev->dev;
                struct plat_serial8250_port *p = dev->platform_data;
 
+               /* Don't map zero-based physical address */
+               if (p->mapbase == 0) {
+                       printk(KERN_WARNING "omap serial: No physical address"
+                              " for uart#%d, so skipping early_init...\n", i);
+                       continue;
+               }
                /*
                 * Module 4KB + L4 interconnect 4KB
                 * Static mapping, never released
@@ -727,6 +733,13 @@ void __init omap_serial_init_port(int port)
        pdev = &uart->pdev;
        dev = &pdev->dev;
 
+       /* Don't proceed if there's no clocks available */
+       if (unlikely(!uart->ick || !uart->fck)) {
+               WARN(1, "%s: can't init uart%d, no clocks available\n",
+                    kobject_name(&dev->kobj), port);
+               return;
+       }
+
        omap_uart_enable_clocks(uart);
 
        omap_uart_reset(uart);