vfio-mdev/samples: Use u8 instead of char for handle functions
authorNathan Chancellor <natechancellor@gmail.com>
Fri, 19 Oct 2018 18:04:27 +0000 (11:04 -0700)
committerGreg Kroah-Hartman <gregkh@linuxfoundation.org>
Thu, 5 Dec 2019 14:37:27 +0000 (15:37 +0100)
commita509ddd2fb1b2bdcbe4596651c68a6eac594ea04
treea2eacf2f33cda415c67d9da5a5e8deaa925d277c
parente50bf6849f4de99385ba6bbc548cc0ecc86a5cdb
vfio-mdev/samples: Use u8 instead of char for handle functions

[ Upstream commit 8ba35b3a0046d6573c98f00461d9bd1b86250d35 ]

Clang warns:

samples/vfio-mdev/mtty.c:592:39: warning: implicit conversion from 'int'
to 'char' changes value from 162 to -94 [-Wconstant-conversion]
                *buf = UART_MSR_DSR | UART_MSR_DDSR | UART_MSR_DCD;
                     ~ ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~^~~~~~~~~~~~~~
1 warning generated.

Turns out that all uses of buf in this function ultimately end up stored
or cast to an unsigned type. Just use u8, which has the same number of
bits but can store this larger number so Clang no longer warns.

Signed-off-by: Nathan Chancellor <natechancellor@gmail.com>
Signed-off-by: Alex Williamson <alex.williamson@redhat.com>
Signed-off-by: Sasha Levin <sashal@kernel.org>
samples/vfio-mdev/mtty.c