OMAP3: serial: Check for zero-based physical addr

Previous message: [thread] [date] [author]
Next message: [thread] [date] [author]
From: Linux Kernel Mailing List
Date: Tuesday, April 27, 2010 - 9:59 am

Gitweb:     http://git.kernel.org/linus/e88d556dc5f0ef437e3538277a1dd33e5038be77
Commit:     e88d556dc5f0ef437e3538277a1dd33e5038be77
Parent:     29b2ee5af5f3a02846bd38a1e2121d62ee5f6aca
Author:     Sergio Aguirre <saaguirre@ti.com>
AuthorDate: Sat Feb 27 14:13:43 2010 -0600
Committer:  Sergio Aguirre <saaguirre@ti.com>
CommitDate: Mon Mar 15 16:33:31 2010 -0500

    OMAP3: serial: Check for zero-based physical addr
    
    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 |   13 +++++++++++++
 1 files changed, 13 insertions(+), 0 deletions(-)

diff --git a/arch/arm/mach-omap2/serial.c b/arch/arm/mach-omap2/serial.c
index da77930..ef91fc0 100644
--- a/arch/arm/mach-omap2/serial.c
+++ b/arch/arm/mach-omap2/serial.c
@@ -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);
--
To unsubscribe from this list: send the line "unsubscribe git-commits-head" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Previous message: [thread] [date] [author]
Next message: [thread] [date] [author]

Messages in current thread:
OMAP3: serial: Check for zero-based physical addr, Linux Kernel Mailing ..., (Tue Apr 27, 9:59 am)