Re: [PATCH 0/4] serial: 8250: Fixes for Oxford Semiconductor 950 UARTs
From: Maciej W. Rozycki
Date: Tue Jun 15 2021 - 10:25:58 EST
On Tue, 15 Jun 2021, Greg Kroah-Hartman wrote:
> This patch series causes the following build warning to be added:
>
> drivers/tty/serial/8250/8250_pci.c: In function ‘pci_oxsemi_tornado_setup’:
> drivers/tty/serial/8250/8250_pci.c:1258:32: warning: unsigned conversion from ‘int’ to ‘unsigned char’ changes value from ‘-129’ to ‘127’ [-Woverflow]
> 1258 | up->mcr_mask = ~UART_MCR_CLKSEL;
> | ^
>
>
> Can you fix this up and resend?
I've seen that, but that's not a problem with my change, but rather with
<linux/serial_reg.h> making this macro (and the remaining ones from this
group) expand to a signed constant (0x80 rather than 0x80u).
I can fix the header, but that would be a separate change, and mind too
that this is a user header, so it's not clear to me what the impact might
be on user apps making use of it.
We could use a GCC pragma to suppress the warning temporarily across this
piece of code, but it's not clear to me either what our policy has been on
such approach.
Thoughts?
NB casting UART_MCR_CLKSEL here to an unsigned type does not help as GCC
still sees the original constant through the cast; I've already tried that
of course.
Last but not least: do we need to have this warning enabled in the first
place?
Maciej