Messages in this thread | | | From | Eric Dumazet <> | Date | Fri, 31 Mar 2023 18:58:25 +0200 | Subject | Re: [PATCH] net: netcp: MAX_SKB_FRAGS is now 'int' |
| |
On Fri, Mar 31, 2023 at 5:08 PM Alexander Lobakin <aleksander.lobakin@intel.com> wrote: > > From: Arnd Bergmann <arnd@kernel.org> > Date: Fri, 31 Mar 2023 09:48:56 +0200 > > > From: Arnd Bergmann <arnd@arndb.de> > > > > The type of MAX_SKB_FRAGS has changed recently, so the debug printk > > needs to be updated: > > > > drivers/net/ethernet/ti/netcp_core.c: In function 'netcp_create_interface': > > drivers/net/ethernet/ti/netcp_core.c:2084:30: error: format '%ld' expects argument of type 'long int', but argument 3 has type 'int' [-Werror=format=] > > 2084 | dev_err(dev, "tx-pool size too small, must be at least %ld\n", > > | ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ > > > > Fixes: 3948b05950fd ("net: introduce a config option to tweak MAX_SKB_FRAGS") > > Signed-off-by: Arnd Bergmann <arnd@arndb.de> > > --- > > drivers/net/ethernet/ti/netcp_core.c | 2 +- > > 1 file changed, 1 insertion(+), 1 deletion(-) > > > > diff --git a/drivers/net/ethernet/ti/netcp_core.c b/drivers/net/ethernet/ti/netcp_core.c > > index 1bb596a9d8a2..dfdbcdeb991f 100644 > > --- a/drivers/net/ethernet/ti/netcp_core.c > > +++ b/drivers/net/ethernet/ti/netcp_core.c > > @@ -2081,7 +2081,7 @@ static int netcp_create_interface(struct netcp_device *netcp_device, > > netcp->tx_pool_region_id = temp[1]; > > > > if (netcp->tx_pool_size < MAX_SKB_FRAGS) { > > - dev_err(dev, "tx-pool size too small, must be at least %ld\n", > > + dev_err(dev, "tx-pool size too small, must be at least %d\n", > > MAX_SKB_FRAGS); > > ret = -ENODEV; > > goto quit; > > (not related to the actual fix) > > I'd personally define %MAX_SKB_FRAGS as `(u32)CONFIG_MAX_SKB_FRAGS`. > It can't be below zero or above %U32_MAX and we have to define it > manually anyway, so why not cast to the type expected from it :D >
Some files have the assumption MAX_SKB_FRAGS can be understood by the C preprocessor.
#if MAX_SKB_FRAGS > 32 ...
Kconfig does not allow to define unsigned int. That would be the easiest way really...
| |