diff options
author | Alexander Sverdlin <alexander.sverdlin@nokia.com> | 2016-09-12 13:29:29 +0200 |
---|---|---|
committer | Greg Kroah-Hartman <gregkh@linuxfoundation.org> | 2016-09-13 18:54:34 +0200 |
commit | 8b2303de399f66b0da2c7e5bcc8296be574766f1 (patch) | |
tree | c1ec69422061726fe637668813ce67952c8d900b /drivers/tty | |
parent | serial: imx: add error messages when .probe fails (diff) | |
download | linux-8b2303de399f66b0da2c7e5bcc8296be574766f1.tar.xz linux-8b2303de399f66b0da2c7e5bcc8296be574766f1.zip |
serial: core: Fix handling of options after MMIO address
Guenter Roeck reported a regression caused by commit "serial: earlycon:
Extend earlycon command line option to support 64-bit addresses":
console= and earlycon= options have the following format:
...,<addr>,<options>
Historically used here simple_strtoul() had no problems with comma, but the
new and recommended kstrtoull() requires null-terminated string and returns
-EINVAL in case there are "options" at the end. There is no recommended to
use function currently that will support it, so stick to obsolete
simple_strtoull() variant.
Signed-off-by: Alexander Sverdlin <alexander.sverdlin@nokia.com>
Reported-by: Guenter Roeck <linux@roeck-us.net>
Reviewed-by: Guenter Roeck <linux@roeck-us.net>
Tested-by: Guenter Roeck <linux@roeck-us.net>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
Diffstat (limited to 'drivers/tty')
-rw-r--r-- | drivers/tty/serial/serial_core.c | 14 |
1 files changed, 6 insertions, 8 deletions
diff --git a/drivers/tty/serial/serial_core.c b/drivers/tty/serial/serial_core.c index 240d3e7a548c..6b7f857fc3b0 100644 --- a/drivers/tty/serial/serial_core.c +++ b/drivers/tty/serial/serial_core.c @@ -1892,14 +1892,11 @@ uart_get_console(struct uart_port *ports, int nr, struct console *co) * console=<name>,0x<addr>,<options> * is also accepted; the returned @iotype will be UPIO_MEM. * - * Returns 0 on success, -EINVAL or -ERANGE on failure + * Returns 0 on success or -EINVAL on failure */ int uart_parse_earlycon(char *p, unsigned char *iotype, resource_size_t *addr, char **options) { - int ret; - unsigned long long tmp; - if (strncmp(p, "mmio,", 5) == 0) { *iotype = UPIO_MEM; p += 5; @@ -1925,10 +1922,11 @@ int uart_parse_earlycon(char *p, unsigned char *iotype, resource_size_t *addr, return -EINVAL; } - ret = kstrtoull(p, 0, &tmp); - if (ret) - return ret; - *addr = tmp; + /* + * Before you replace it with kstrtoull(), think about options separator + * (',') it will not tolerate + */ + *addr = simple_strtoull(p, NULL, 0); p = strchr(p, ','); if (p) p++; |