Messages in this thread | | | Date | Thu, 09 Sep 2010 00:23:55 -0700 | From | Yinghai Lu <> | Subject | Re: [PATCH] x86, setup: fix earlyprintk=serial,0x3f8,115200 |
| |
On 09/08/2010 02:28 PM, H. Peter Anvin wrote: > On 08/29/2010 06:13 PM, Yinghai Lu wrote: >> >> earlyprintk could take io port. >> >> So we need to handle this case in setup code too, otherwise 0x3f8 >> will be treated as baud rate. >> > > What about a non-hexadecimal port? It seems more logical to me to move > the strncmp() up and test that before using simple_strtoull().
non-hex is not supported...
in arch/x86/kernel/early_printk.c static __init void early_serial_init(char *s) { unsigned char c; unsigned divisor; unsigned baud = DEFAULT_BAUD; char *e;
if (*s == ',') ++s;
if (*s) { unsigned port; if (!strncmp(s, "0x", 2)) { early_serial_base = simple_strtoul(s, &e, 16); } else { static const int __initconst bases[] = { 0x3f8, 0x2f8 };
if (!strncmp(s, "ttyS", 4)) s += 4; port = simple_strtoul(s, &e, 10); if (port > 1 || s == e) port = 0; early_serial_base = bases[port]; } s += strcspn(s, ","); if (*s == ',') s++; }
so it check 0x too.
Yinghai
| |