• Bill Wendling's avatar
    bnx2x: use correct format characters · d65aea8e
    Bill Wendling authored
    When compiling with -Wformat, clang emits the following warnings:
    
    drivers/net/ethernet/broadcom/bnx2x/bnx2x_link.c:6181:40: warning: format
    specifies type 'unsigned short' but the argument has type 'u32'
    (aka 'unsigned int') [-Wformat]
            ret = scnprintf(str, *len, "%hx.%hx", num >> 16, num);
                                        ~~~       ^~~~~~~~~
                                        %x
    drivers/net/ethernet/broadcom/bnx2x/bnx2x_link.c:6181:51: warning: format
    specifies type 'unsigned short' but the argument has type 'u32'
    (aka 'unsigned int') [-Wformat]
            ret = scnprintf(str, *len, "%hx.%hx", num >> 16, num);
                                            ~~~              ^~~
                                            %x
    drivers/net/ethernet/broadcom/bnx2x/bnx2x_link.c:6196:47: warning: format
    specifies type 'unsigned char' but the argument has type 'u32'
    (aka 'unsigned int') [-Wformat]
            ret = scnprintf(str, *len, "%hhx.%hhx.%hhx", num >> 16, num >> 8, num);
                                        ~~~~             ^~~~~~~~~
                                        %x
    drivers/net/ethernet/broadcom/bnx2x/bnx2x_link.c:6196:58: warning: format
    specifies type 'unsigned char' but the argument has type 'u32'
    (aka 'unsigned int') [-Wformat]
            ret = scnprintf(str, *len, "%hhx.%hhx.%hhx", num >> 16, num >> 8, num);
                                             ~~~~                   ^~~~~~~~
                                             %x
    drivers/net/ethernet/broadcom/bnx2x/bnx2x_link.c:6196:68: warning: format
    specifies type 'unsigned char' but the argument has type 'u32'
    (aka 'unsigned int') [-Wformat]
            ret = scnprintf(str, *len, "%hhx.%hhx.%hhx", num >> 16, num >> 8, num);
                                                  ~~~~                        ^~~
                                                  %x
    
    The types of these arguments are unconditionally defined, so this patch
    updates the format character to the correct ones for ints and unsigned
    ints.
    
    Link: https://github.com/ClangBuiltLinux/linux/issues/378Signed-off-by: default avatarBill Wendling <morbo@google.com>
    Link: https://lore.kernel.org/r/20220316213104.2351651-1-morbo@google.comSigned-off-by: default avatarJakub Kicinski <kuba@kernel.org>
    d65aea8e
bnx2x_link.c 408 KB