[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index] Re: [PATCH 4/6] arm/duart: make dt_uart_init() compile with -Wwrite-strings
On Mon, 20 Nov 2023, Andrew Cooper wrote: > 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.cooper3@xxxxxxxxxx> Reviewed-by: Stefano Stabellini <sstabellini@xxxxxxxxxx> > --- > CC: Stefano Stabellini <sstabellini@xxxxxxxxxx> > CC: Julien Grall <julien@xxxxxxx> > CC: Volodymyr Babchuk <Volodymyr_Babchuk@xxxxxxxx> > CC: Bertrand Marquis <bertrand.marquis@xxxxxxx> > CC: Michal Orzel <michal.orzel@xxxxxxx> > CC: Roberto Bagnara <roberto.bagnara@xxxxxxxxxxx> > CC: Nicola Vetrini <nicola.vetrini@xxxxxxxxxxx> > --- > 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 > >
|
Lists.xenproject.org is hosted with RackSpace, monitoring our |