* [PATCH] nfp: fix clang -Wformat warnings
@ 2022-07-12 0:01 Justin Stitt
2022-07-12 9:21 ` Simon Horman
2022-07-13 0:50 ` patchwork-bot+netdevbpf
0 siblings, 2 replies; 3+ messages in thread
From: Justin Stitt @ 2022-07-12 0:01 UTC (permalink / raw)
To: Simon Horman, David S . Miller, Eric Dumazet, Paolo Abeni
Cc: Jakub Kicinski, Nathan Chancellor, Nick Desaulniers, Tom Rix,
Justin Stitt, Fei Qin, Yu Xiao, Yinjun Zhang, Dirk van der Merwe,
Leon Romanovsky, oss-drivers, netdev, linux-kernel, llvm
When building with Clang we encounter these warnings:
| drivers/net/ethernet/netronome/nfp/nfp_app.c:233:99: error: format
| specifies type 'unsigned char' but the argument has underlying type
| 'unsigned int' [-Werror,-Wformat] nfp_err(pf->cpp, "unknown FW app ID
| 0x%02hhx, driver too old or support for FW not built in\n", id);
-
| drivers/net/ethernet/netronome/nfp/nfp_main.c:396:11: error: format
| specifies type 'unsigned char' but the argument has type 'int'
| [-Werror,-Wformat] serial, interface >> 8, interface & 0xff);
Correct format specifier for `id` is `%x` since the default type for the
`nfp_app_id` enum is `unsigned int`. The second warning is also solved
by using the `%x` format specifier as the expressions involving
`interface` are implicity promoted to integers (%x is used to maintain
hexadecimal representation).
Link: https://github.com/ClangBuiltLinux/linux/issues/378
Signed-off-by: Justin Stitt <justinstitt@google.com>
---
drivers/net/ethernet/netronome/nfp/nfp_app.c | 2 +-
drivers/net/ethernet/netronome/nfp/nfp_main.c | 2 +-
2 files changed, 2 insertions(+), 2 deletions(-)
diff --git a/drivers/net/ethernet/netronome/nfp/nfp_app.c b/drivers/net/ethernet/netronome/nfp/nfp_app.c
index 09f250e74dfa..bb3f46c74f77 100644
--- a/drivers/net/ethernet/netronome/nfp/nfp_app.c
+++ b/drivers/net/ethernet/netronome/nfp/nfp_app.c
@@ -230,7 +230,7 @@ struct nfp_app *nfp_app_alloc(struct nfp_pf *pf, enum nfp_app_id id)
struct nfp_app *app;
if (id >= ARRAY_SIZE(apps) || !apps[id]) {
- nfp_err(pf->cpp, "unknown FW app ID 0x%02hhx, driver too old or support for FW not built in\n", id);
+ nfp_err(pf->cpp, "unknown FW app ID 0x%02x, driver too old or support for FW not built in\n", id);
return ERR_PTR(-EINVAL);
}
diff --git a/drivers/net/ethernet/netronome/nfp/nfp_main.c b/drivers/net/ethernet/netronome/nfp/nfp_main.c
index 4f88d17536c3..43b9e75a34a5 100644
--- a/drivers/net/ethernet/netronome/nfp/nfp_main.c
+++ b/drivers/net/ethernet/netronome/nfp/nfp_main.c
@@ -392,7 +392,7 @@ nfp_net_fw_find(struct pci_dev *pdev, struct nfp_pf *pf)
/* First try to find a firmware image specific for this device */
interface = nfp_cpp_interface(pf->cpp);
nfp_cpp_serial(pf->cpp, &serial);
- sprintf(fw_name, "netronome/serial-%pMF-%02hhx-%02hhx.nffw",
+ sprintf(fw_name, "netronome/serial-%pMF-%02x-%02x.nffw",
serial, interface >> 8, interface & 0xff);
fw = nfp_net_fw_request(pdev, pf, fw_name);
if (fw)
--
2.37.0.144.g8ac04bfd2-goog
^ permalink raw reply related [flat|nested] 3+ messages in thread
* Re: [PATCH] nfp: fix clang -Wformat warnings
2022-07-12 0:01 [PATCH] nfp: fix clang -Wformat warnings Justin Stitt
@ 2022-07-12 9:21 ` Simon Horman
2022-07-13 0:50 ` patchwork-bot+netdevbpf
1 sibling, 0 replies; 3+ messages in thread
From: Simon Horman @ 2022-07-12 9:21 UTC (permalink / raw)
To: Justin Stitt
Cc: David S . Miller, Eric Dumazet, Paolo Abeni, Jakub Kicinski,
Nathan Chancellor, Nick Desaulniers, Tom Rix, Fei Qin, Yu Xiao,
Yinjun Zhang, Dirk van der Merwe, Leon Romanovsky, oss-drivers,
netdev, linux-kernel, llvm
On Mon, Jul 11, 2022 at 05:01:52PM -0700, Justin Stitt wrote:
> When building with Clang we encounter these warnings:
> | drivers/net/ethernet/netronome/nfp/nfp_app.c:233:99: error: format
> | specifies type 'unsigned char' but the argument has underlying type
> | 'unsigned int' [-Werror,-Wformat] nfp_err(pf->cpp, "unknown FW app ID
> | 0x%02hhx, driver too old or support for FW not built in\n", id);
> -
> | drivers/net/ethernet/netronome/nfp/nfp_main.c:396:11: error: format
> | specifies type 'unsigned char' but the argument has type 'int'
> | [-Werror,-Wformat] serial, interface >> 8, interface & 0xff);
>
> Correct format specifier for `id` is `%x` since the default type for the
> `nfp_app_id` enum is `unsigned int`. The second warning is also solved
> by using the `%x` format specifier as the expressions involving
> `interface` are implicity promoted to integers (%x is used to maintain
> hexadecimal representation).
>
> Link: https://github.com/ClangBuiltLinux/linux/issues/378
> Signed-off-by: Justin Stitt <justinstitt@google.com>
Thanks for improving the nfp driver.
Reviewed-by: Simon Horman <simon.horman@corigine.com>
^ permalink raw reply [flat|nested] 3+ messages in thread
* Re: [PATCH] nfp: fix clang -Wformat warnings
2022-07-12 0:01 [PATCH] nfp: fix clang -Wformat warnings Justin Stitt
2022-07-12 9:21 ` Simon Horman
@ 2022-07-13 0:50 ` patchwork-bot+netdevbpf
1 sibling, 0 replies; 3+ messages in thread
From: patchwork-bot+netdevbpf @ 2022-07-13 0:50 UTC (permalink / raw)
To: Justin Stitt
Cc: simon.horman, davem, edumazet, pabeni, kuba, nathan,
ndesaulniers, trix, fei.qin, yu.xiao, yinjun.zhang,
dirk.vandermerwe, leon, oss-drivers, netdev, linux-kernel, llvm
Hello:
This patch was applied to netdev/net-next.git (master)
by Jakub Kicinski <kuba@kernel.org>:
On Mon, 11 Jul 2022 17:01:52 -0700 you wrote:
> When building with Clang we encounter these warnings:
> | drivers/net/ethernet/netronome/nfp/nfp_app.c:233:99: error: format
> | specifies type 'unsigned char' but the argument has underlying type
> | 'unsigned int' [-Werror,-Wformat] nfp_err(pf->cpp, "unknown FW app ID
> | 0x%02hhx, driver too old or support for FW not built in\n", id);
> -
> | drivers/net/ethernet/netronome/nfp/nfp_main.c:396:11: error: format
> | specifies type 'unsigned char' but the argument has type 'int'
> | [-Werror,-Wformat] serial, interface >> 8, interface & 0xff);
>
> [...]
Here is the summary with links:
- nfp: fix clang -Wformat warnings
https://git.kernel.org/netdev/net-next/c/ef2a95db8900
You are awesome, thank you!
--
Deet-doot-dot, I am a bot.
https://korg.docs.kernel.org/patchwork/pwbot.html
^ permalink raw reply [flat|nested] 3+ messages in thread
end of thread, other threads:[~2022-07-13 0:50 UTC | newest]
Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2022-07-12 0:01 [PATCH] nfp: fix clang -Wformat warnings Justin Stitt
2022-07-12 9:21 ` Simon Horman
2022-07-13 0:50 ` patchwork-bot+netdevbpf
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).