OSDN Git Service

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 08:20:28 +0000 (09:20 +0100)
commit005874c5170e70c92010a23d766f76f721ae52ba
tree6cd785b37a48df62ad5ceaf815fcecbc2e55bd8f
parent962b1f6b0307c205467fe868b7c68f85f44c6c7d
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