Skip to content

Commit 6d48b79

Browse files
arndbIngo Molnar
authored andcommitted
lockdep: Address clang -Wformat warning printing for %hd
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: de8f5e4 ("lockdep: Introduce wait-type checks") Signed-off-by: Arnd Bergmann <[email protected]> Signed-off-by: Ingo Molnar <[email protected]> Link: https://lore.kernel.org/r/[email protected]
1 parent 3a85969 commit 6d48b79

File tree

1 file changed

+1
-1
lines changed

1 file changed

+1
-1
lines changed

kernel/locking/lockdep.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -705,7 +705,7 @@ static void print_lock_name(struct lock_class *class)
705705

706706
printk(KERN_CONT " (");
707707
__print_lock_name(class);
708-
printk(KERN_CONT "){%s}-{%hd:%hd}", usage,
708+
printk(KERN_CONT "){%s}-{%d:%d}", usage,
709709
class->wait_type_outer ?: class->wait_type_inner,
710710
class->wait_type_inner);
711711
}

0 commit comments

Comments
 (0)