Skip to content

Commit

Permalink
serial: stm32: Fix comparisons with undefined register
Browse files Browse the repository at this point in the history
    drivers/tty/serial/stm32-usart.c: In function ‘stm32_receive_chars’:
    drivers/tty/serial/stm32-usart.c:130: warning: comparison is always true due to limited range of data type
    drivers/tty/serial/stm32-usart.c: In function ‘stm32_tx_dma_complete’:
    drivers/tty/serial/stm32-usart.c:177: warning: comparison is always false due to limited range of data type

stm32_usart_offsets.icr is u8, while UNDEF_REG = ~0 is int, and thus
0xffffffff.

As all registers in stm32_usart_offsets are u8, change the definition of
UNDEF_REG to 0xff to fix this.

Fixes: ada8618 ("serial: stm32: adding support for stm32f7")
Signed-off-by: Geert Uytterhoeven <[email protected]>
Signed-off-by: Greg Kroah-Hartman <[email protected]>
  • Loading branch information
geertu authored and gregkh committed Oct 27, 2016
1 parent 42acfc6 commit b20fb13
Showing 1 changed file with 1 addition and 1 deletion.
2 changes: 1 addition & 1 deletion drivers/tty/serial/stm32-usart.h
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,7 @@ struct stm32_usart_info {
struct stm32_usart_config cfg;
};

#define UNDEF_REG ~0
#define UNDEF_REG 0xff

/* Register offsets */
struct stm32_usart_info stm32f4_info = {
Expand Down

0 comments on commit b20fb13

Please sign in to comment.