Linux kernel mirror (for testing) git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
kernel os linux

net: ethernet: ti: Fix format specifier in netcp_create_interface()

After commit 3948b05950fd ("net: introduce a config option to tweak
MAX_SKB_FRAGS"), clang warns:

drivers/net/ethernet/ti/netcp_core.c:2085:4: warning: format specifies type 'long' but the argument has type 'int' [-Wformat]
MAX_SKB_FRAGS);
^~~~~~~~~~~~~
include/linux/dev_printk.h:144:65: note: expanded from macro 'dev_err'
dev_printk_index_wrap(_dev_err, KERN_ERR, dev, dev_fmt(fmt), ##__VA_ARGS__)
~~~ ^~~~~~~~~~~
include/linux/dev_printk.h:110:23: note: expanded from macro 'dev_printk_index_wrap'
_p_func(dev, fmt, ##__VA_ARGS__); \
~~~ ^~~~~~~~~~~
include/linux/skbuff.h:352:23: note: expanded from macro 'MAX_SKB_FRAGS'
#define MAX_SKB_FRAGS CONFIG_MAX_SKB_FRAGS
^~~~~~~~~~~~~~~~~~~~
./include/generated/autoconf.h:11789:30: note: expanded from macro 'CONFIG_MAX_SKB_FRAGS'
#define CONFIG_MAX_SKB_FRAGS 17
^~
1 warning generated.

Follow the pattern of the rest of the tree by changing the specifier to
'%u' and casting MAX_SKB_FRAGS explicitly to 'unsigned int', which
eliminates the warning.

Fixes: 3948b05950fd ("net: introduce a config option to tweak MAX_SKB_FRAGS")
Signed-off-by: Nathan Chancellor <nathan@kernel.org>
Reviewed-by: Nick Desaulniers <ndesaulniers@google.com>
Link: https://lore.kernel.org/r/20230329-net-ethernet-ti-wformat-v1-1-83d0f799b553@kernel.org
Signed-off-by: Jakub Kicinski <kuba@kernel.org>

authored by

Nathan Chancellor and committed by
Jakub Kicinski
3292004c eb1ab765

+2 -2
+2 -2
drivers/net/ethernet/ti/netcp_core.c
··· 2081 2081 netcp->tx_pool_region_id = temp[1]; 2082 2082 2083 2083 if (netcp->tx_pool_size < MAX_SKB_FRAGS) { 2084 - dev_err(dev, "tx-pool size too small, must be at least %ld\n", 2085 - MAX_SKB_FRAGS); 2084 + dev_err(dev, "tx-pool size too small, must be at least %u\n", 2085 + (unsigned int)MAX_SKB_FRAGS); 2086 2086 ret = -ENODEV; 2087 2087 goto quit; 2088 2088 }