diff mbox series

bnx2x: use correct format characters

Message ID 20220316213104.2351651-1-morbo@google.com (mailing list archive)
State Accepted
Commit d65aea8e829815e3d2bd677d7bfdd842bcd3853b
Delegated to: Netdev Maintainers
Headers show
Series bnx2x: use correct format characters | expand

Checks

Context Check Description
netdev/fixes_present success Fixes tag not required for -next series
netdev/subject_prefix warning Target tree name not specified in the subject
netdev/cover_letter success Single patches do not need cover letters
netdev/patch_count success Link
netdev/header_inline success No static functions without inline keyword in header files
netdev/build_32bit success Errors and warnings before: 1 this patch: 1
netdev/cc_maintainers success CCed 9 of 9 maintainers
netdev/build_clang success Errors and warnings before: 6 this patch: 0
netdev/module_param success Was 0 now: 0
netdev/verify_signedoff success Signed-off-by tag matches author and committer
netdev/verify_fixes success No Fixes tag
netdev/build_allmodconfig_warn success Errors and warnings before: 1 this patch: 1
netdev/checkpatch success total: 0 errors, 0 warnings, 0 checks, 16 lines checked
netdev/kdoc success Errors and warnings before: 0 this patch: 0
netdev/source_inline success Was 0 now: 0
netdev/tree_selection success Guessing tree name failed - patch did not apply

Commit Message

Bill Wendling March 16, 2022, 9:31 p.m. UTC
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: ClangBuiltLinux/linux#378
Signed-off-by: Bill Wendling <morbo@google.com>
---
 drivers/net/ethernet/broadcom/bnx2x/bnx2x_link.c | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

Comments

patchwork-bot+netdevbpf@kernel.org March 17, 2022, 11:50 p.m. UTC | #1
Hello:

This patch was applied to netdev/net-next.git (master)
by Jakub Kicinski <kuba@kernel.org>:

On Wed, 16 Mar 2022 14:31:04 -0700 you wrote:
> 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
> 
> [...]

Here is the summary with links:
  - bnx2x: use correct format characters
    https://git.kernel.org/netdev/net-next/c/d65aea8e8298

You are awesome, thank you!
diff mbox series

Patch

diff --git a/drivers/net/ethernet/broadcom/bnx2x/bnx2x_link.c b/drivers/net/ethernet/broadcom/bnx2x/bnx2x_link.c
index 4e85e7dbc2be..bede16760388 100644
--- a/drivers/net/ethernet/broadcom/bnx2x/bnx2x_link.c
+++ b/drivers/net/ethernet/broadcom/bnx2x/bnx2x_link.c
@@ -6178,7 +6178,7 @@  static int bnx2x_format_ver(u32 num, u8 *str, u16 *len)
 		return -EINVAL;
 	}
 
-	ret = scnprintf(str, *len, "%hx.%hx", num >> 16, num);
+	ret = scnprintf(str, *len, "%x.%x", num >> 16, num);
 	*len -= ret;
 	return 0;
 }
@@ -6193,7 +6193,7 @@  static int bnx2x_3_seq_format_ver(u32 num, u8 *str, u16 *len)
 		return -EINVAL;
 	}
 
-	ret = scnprintf(str, *len, "%hhx.%hhx.%hhx", num >> 16, num >> 8, num);
+	ret = scnprintf(str, *len, "%x.%x.%x", num >> 16, num >> 8, num);
 	*len -= ret;
 	return 0;
 }