arm: tegra: Avoid negative number parsing for debug port
Laxman Dewangan [Wed, 28 Sep 2011 09:12:49 +0000 (14:12 +0530)]
Avoiding negative number parsing for debug port id.

bug 854995

Reviewed-on: http://git-master/r/57328
(cherry picked from commit 81ce6594db0a2b9131e3a1317ef1f10e8310aad5)
Change-Id: I38e9e545c06a61b79d292c86dcbf8c595d2eddca
Reviewed-on: http://git-master/r/57787
Reviewed-by: Varun Colbert <vcolbert@nvidia.com>
Tested-by: Varun Colbert <vcolbert@nvidia.com>

Rebase-Id: R2fe0b743db9f2b87f0a0715aeda12e7c00b041a7

arch/arm/mach-tegra/common.c

index 4b5c12a..580dc88 100644 (file)
@@ -363,15 +363,22 @@ early_param("core_edp_mv", tegra_pmu_core_edp);
 static int __init tegra_debug_uartport(char *info)
 {
        char *p = info;
+       unsigned long long port_id;
        if (!strncmp(p, "hsport", 6))
                is_tegra_debug_uart_hsport = true;
        else if (!strncmp(p, "lsport", 6))
                is_tegra_debug_uart_hsport = false;
 
-       if (p[6] == ',')
-               debug_uart_port_id = memparse(p + 7, &p);
-       else
+       if (p[6] == ',') {
+               if (p[7] == '-') {
+                       debug_uart_port_id = -1;
+               } else {
+                       port_id = memparse(p + 7, &p);
+                       debug_uart_port_id = (int) port_id;
+               }
+       } else {
                debug_uart_port_id = -1;
+       }
 
        return 1;
 }