GCC complains: drivers/char/arm-uart.c: In function 'dt_uart_init': drivers/char/arm-uart.c:81:17: error: assignment discards 'const' qualifier from pointer target type [-Werror=discarded-qualifiers] 81 | options = ""; | ^
The problem is using the options string for both splitting opt_duart, and to hold a token "" for no options. Use two variables; one mutable one one const. Signed-off-by: Andrew Cooper <andrew.coop...@citrix.com> --- CC: Stefano Stabellini <sstabell...@kernel.org> CC: Julien Grall <jul...@xen.org> CC: Volodymyr Babchuk <volodymyr_babc...@epam.com> CC: Bertrand Marquis <bertrand.marq...@arm.com> CC: Michal Orzel <michal.or...@amd.com> CC: Roberto Bagnara <roberto.bagn...@bugseng.com> CC: Nicola Vetrini <nicola.vetr...@bugseng.com> --- xen/drivers/char/arm-uart.c | 12 ++++++++---- 1 file changed, 8 insertions(+), 4 deletions(-) diff --git a/xen/drivers/char/arm-uart.c b/xen/drivers/char/arm-uart.c index 8098a968c285..91f13a41368d 100644 --- a/xen/drivers/char/arm-uart.c +++ b/xen/drivers/char/arm-uart.c @@ -42,7 +42,8 @@ static void __init dt_uart_init(void) struct dt_device_node *dev; int ret; const char *devpath = opt_dtuart; - char *options; + const char *options; + char *split; if ( !console_has("dtuart") ) return; /* Not for us */ @@ -74,9 +75,12 @@ static void __init dt_uart_init(void) return; } - options = strchr(opt_dtuart, ':'); - if ( options != NULL ) - *(options++) = '\0'; + split = strchr(opt_dtuart, ':'); + if ( split ) + { + split[0] = '\0'; + options = split + 1; + } else options = ""; -- 2.30.2