From: Sergio Aguirre Subject: [RFC v3][PATCH 1/6] OMAP3: serial: Check for zero-based physical addr Date: Sat, 27 Feb 2010 14:46:06 -0600 Message-ID: <1267303571-3674-2-git-send-email-saaguirre@ti.com> References: <1267303571-3674-1-git-send-email-saaguirre@ti.com> Return-path: Received: from arroyo.ext.ti.com ([192.94.94.40]:58336 "EHLO arroyo.ext.ti.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1030770Ab0B0Up7 (ORCPT ); Sat, 27 Feb 2010 15:45:59 -0500 Received: from dlep33.itg.ti.com ([157.170.170.112]) by arroyo.ext.ti.com (8.13.7/8.13.7) with ESMTP id o1RKjwEO003878 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-SHA bits=256 verify=NO) for ; Sat, 27 Feb 2010 14:45:58 -0600 In-Reply-To: <1267303571-3674-1-git-send-email-saaguirre@ti.com> Sender: linux-omap-owner@vger.kernel.org List-Id: linux-omap@vger.kernel.org To: linux-omap@vger.kernel.org Cc: Sergio Aguirre 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 --- arch/arm/mach-omap2/serial.c | 10 ++++++++++ 1 files changed, 10 insertions(+), 0 deletions(-) diff --git a/arch/arm/mach-omap2/serial.c b/arch/arm/mach-omap2/serial.c index b79bc89..128bfae 100644 --- a/arch/arm/mach-omap2/serial.c +++ b/arch/arm/mach-omap2/serial.c @@ -659,6 +659,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 @@ -722,6 +728,10 @@ void __init omap_serial_init_port(int port) pdev = &uart->pdev; dev = &pdev->dev; + /* Don't proceed if there's no clocks available */ + if (!uart->ick || !uart->fck) + return; + omap_uart_enable_clocks(uart); omap_uart_reset(uart); -- 1.6.3.3