]> git.ipfire.org Git - thirdparty/kernel/stable.git/commit
lockdep: Address clang -Wformat warning printing for %hd
authorArnd Bergmann <arnd@arndb.de>
Mon, 22 Mar 2021 11:55:25 +0000 (12:55 +0100)
committerGreg Kroah-Hartman <gregkh@linuxfoundation.org>
Wed, 14 Apr 2021 06:47:24 +0000 (08:47 +0200)
commitfc1b68fad2030275fa6f4c49b0a79bc4c80328d7
tree35a647a4112c16766c8231e81d0a90b1c9f03ae9
parent460505d684e594f68786581786e2818e70a5b175
lockdep: Address clang -Wformat warning printing for %hd

commit 6d48b7912cc72275dc7c59ff961c8bac7ef66a92 upstream.

Clang doesn't like format strings that truncate a 32-bit
value to something shorter:

  kernel/locking/lockdep.c:709:4: error: format specifies type 'short' but the argument has type 'int' [-Werror,-Wformat]

In this case, the warning is a slightly questionable, as it could realize
that both class->wait_type_outer and class->wait_type_inner are in fact
8-bit struct members, even though the result of the ?: operator becomes an
'int'.

However, there is really no point in printing the number as a 16-bit
'short' rather than either an 8-bit or 32-bit number, so just change
it to a normal %d.

Fixes: de8f5e4f2dc1 ("lockdep: Introduce wait-type checks")
Signed-off-by: Arnd Bergmann <arnd@arndb.de>
Signed-off-by: Ingo Molnar <mingo@kernel.org>
Link: https://lore.kernel.org/r/20210322115531.3987555-1-arnd@kernel.org
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
kernel/locking/lockdep.c