serial: core: Make uart_parse_options take const char* argument
authorPaul Cercueil <paul@crapouillou.net>
Thu, 28 Dec 2017 13:07:07 +0000 (14:07 +0100)
committerGreg Kroah-Hartman <gregkh@linuxfoundation.org>
Tue, 9 Jan 2018 15:46:26 +0000 (16:46 +0100)
The pointed string is never modified from within uart_parse_options, so
it should be marked as const in the function prototype.

Signed-off-by: Paul Cercueil <paul@crapouillou.net>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
drivers/tty/serial/serial_core.c
include/linux/serial_core.h

index f57969de2f1cb2c57401b12f8d9f7580de32ff3f..2148883db66d9c80dc7f8a13a3b17f7adb34d0a8 100644 (file)
@@ -1955,9 +1955,10 @@ EXPORT_SYMBOL_GPL(uart_parse_earlycon);
  *     eg: 115200n8r
  */
 void
-uart_parse_options(char *options, int *baud, int *parity, int *bits, int *flow)
+uart_parse_options(const char *options, int *baud, int *parity,
+                  int *bits, int *flow)
 {
-       char *s = options;
+       const char *s = options;
 
        *baud = simple_strtoul(s, NULL, 10);
        while (*s >= '0' && *s <= '9')
index b60b225c0a599245e85d2abe5f726a736a6ea234..4c310c34ddadd49b9e14b1202522bb493782e8a3 100644 (file)
@@ -387,7 +387,7 @@ struct uart_port *uart_get_console(struct uart_port *ports, int nr,
                                   struct console *c);
 int uart_parse_earlycon(char *p, unsigned char *iotype, resource_size_t *addr,
                        char **options);
-void uart_parse_options(char *options, int *baud, int *parity, int *bits,
+void uart_parse_options(const char *options, int *baud, int *parity, int *bits,
                        int *flow);
 int uart_set_options(struct uart_port *port, struct console *co, int baud,
                     int parity, int bits, int flow);