From 5d025eb2353550eadbd2fa9b8083a92fe9b07bd9 Mon Sep 17 00:00:00 2001 From: Jukka Laitinen Date: Wed, 19 Jan 2022 11:20:17 +0200 Subject: lib: fix pointer of type 'void *' used in arithmetic Using "void *" in arithmetic causes errors with strict compiler settings: "error: pointer of type 'void *' used in arithmetic [-Werror=pointer-arith]" Avoid these by calculating on "char *" where 1-byte data size is assumed. Signed-off-by: Jukka Laitinen Reviewed-by: Dong Du Reviewed-by: Xiang W Reviewed-by: Anup Patel --- lib/utils/serial/sifive-uart.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) (limited to 'lib/utils/serial/sifive-uart.c') diff --git a/lib/utils/serial/sifive-uart.c b/lib/utils/serial/sifive-uart.c index 57d80fa4..9478a77f 100644 --- a/lib/utils/serial/sifive-uart.c +++ b/lib/utils/serial/sifive-uart.c @@ -29,7 +29,7 @@ /* clang-format on */ -static volatile void *uart_base; +static volatile char *uart_base; static u32 uart_in_freq; static u32 uart_baudrate; @@ -90,7 +90,7 @@ static struct sbi_console_device sifive_console = { int sifive_uart_init(unsigned long base, u32 in_freq, u32 baudrate) { - uart_base = (volatile void *)base; + uart_base = (volatile char *)base; uart_in_freq = in_freq; uart_baudrate = baudrate; -- cgit v1.3.1