diff options
author | Rob Herring <robh@kernel.org> | 2014-04-30 20:48:29 -0400 |
---|---|---|
committer | Greg Kroah-Hartman <gregkh@linuxfoundation.org> | 2014-05-03 18:16:38 -0400 |
commit | e26f1db9b8d74617519e50b41749900d0a257406 (patch) | |
tree | 08b42567dad09bafa4ce81d18d9e4c4368dc4157 | |
parent | fe1cf8af918af3ff0dd58ce92e5a5da117cb1d92 (diff) |
tty/serial: fix generic earlycon option parsing
Commit 9aac5887595 (tty/serial: add generic serial earlycon) moved
console option parsing from 8250_early.c and converted to kstrto*
functions from simple_strtoul along the way. However, kstrto* functions
are not equivalent in that they do not allow non-convertible characters
at the end such as "115200n8". Fix this by changing back to
simple_strtoul and ignore what checkpatch.pl says.
Reported-by: Yinghai Lu <yinghai@kernel.org>
Cc: Jiri Slaby <jslaby@suse.cz>
Cc: linux-serial@vger.kernel.org
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
-rw-r--r-- | drivers/tty/serial/earlycon.c | 18 |
1 files changed, 5 insertions, 13 deletions
diff --git a/drivers/tty/serial/earlycon.c b/drivers/tty/serial/earlycon.c index 73bf1e21aae0..c92e83088adb 100644 --- a/drivers/tty/serial/earlycon.c +++ b/drivers/tty/serial/earlycon.c | |||
@@ -53,7 +53,7 @@ static int __init parse_options(struct earlycon_device *device, | |||
53 | char *options) | 53 | char *options) |
54 | { | 54 | { |
55 | struct uart_port *port = &device->port; | 55 | struct uart_port *port = &device->port; |
56 | int mmio, mmio32, length, ret; | 56 | int mmio, mmio32, length; |
57 | unsigned long addr; | 57 | unsigned long addr; |
58 | 58 | ||
59 | if (!options) | 59 | if (!options) |
@@ -64,25 +64,19 @@ static int __init parse_options(struct earlycon_device *device, | |||
64 | if (mmio || mmio32) { | 64 | if (mmio || mmio32) { |
65 | port->iotype = (mmio ? UPIO_MEM : UPIO_MEM32); | 65 | port->iotype = (mmio ? UPIO_MEM : UPIO_MEM32); |
66 | options += mmio ? 5 : 7; | 66 | options += mmio ? 5 : 7; |
67 | ret = kstrtoul(options, 0, &addr); | 67 | addr = simple_strtoul(options, NULL, 0); |
68 | if (ret) | ||
69 | return ret; | ||
70 | port->mapbase = addr; | 68 | port->mapbase = addr; |
71 | if (mmio32) | 69 | if (mmio32) |
72 | port->regshift = 2; | 70 | port->regshift = 2; |
73 | } else if (!strncmp(options, "io,", 3)) { | 71 | } else if (!strncmp(options, "io,", 3)) { |
74 | port->iotype = UPIO_PORT; | 72 | port->iotype = UPIO_PORT; |
75 | options += 3; | 73 | options += 3; |
76 | ret = kstrtoul(options, 0, &addr); | 74 | addr = simple_strtoul(options, NULL, 0); |
77 | if (ret) | ||
78 | return ret; | ||
79 | port->iobase = addr; | 75 | port->iobase = addr; |
80 | mmio = 0; | 76 | mmio = 0; |
81 | } else if (!strncmp(options, "0x", 2)) { | 77 | } else if (!strncmp(options, "0x", 2)) { |
82 | port->iotype = UPIO_MEM; | 78 | port->iotype = UPIO_MEM; |
83 | ret = kstrtoul(options, 0, &addr); | 79 | addr = simple_strtoul(options, NULL, 0); |
84 | if (ret) | ||
85 | return ret; | ||
86 | port->mapbase = addr; | 80 | port->mapbase = addr; |
87 | } else { | 81 | } else { |
88 | return -EINVAL; | 82 | return -EINVAL; |
@@ -93,9 +87,7 @@ static int __init parse_options(struct earlycon_device *device, | |||
93 | options = strchr(options, ','); | 87 | options = strchr(options, ','); |
94 | if (options) { | 88 | if (options) { |
95 | options++; | 89 | options++; |
96 | ret = kstrtouint(options, 0, &device->baud); | 90 | device->baud = simple_strtoul(options, NULL, 0); |
97 | if (ret) | ||
98 | return ret; | ||
99 | length = min(strcspn(options, " ") + 1, | 91 | length = min(strcspn(options, " ") + 1, |
100 | (size_t)(sizeof(device->options))); | 92 | (size_t)(sizeof(device->options))); |
101 | strlcpy(device->options, options, length); | 93 | strlcpy(device->options, options, length); |