Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]


Groups > linux.kernel > #1363603

Re: [PATCH] net: mlxsw: avoid unused variable warnings

From David Miller <davem@davemloft.net>
Newsgroups linux.kernel
Subject Re: [PATCH] net: mlxsw: avoid unused variable warnings
Date 2016-03-23 19:40 +0100
Message-ID <rfVRf-7vh-3@gated-at.bofh.it> (permalink)
References <rfTZ8-69G-29@gated-at.bofh.it> <rfUiu-6gL-11@gated-at.bofh.it>
Organization linux.* mail to news gateway

Show all headers | View raw


From: Andrew Lunn <andrew@lunn.ch>
Date: Wed, 23 Mar 2016 17:51:11 +0100

> On Wed, Mar 23, 2016 at 05:37:38PM +0100, Arnd Bergmann wrote:
>> dev_dbg_ratelimited() is a macro that ignores its arguments when DEBUG is
>> not set, which can lead to unused variable warnings:
>> 
>> ethernet/mellanox/mlxsw/pci.c: In function 'mlxsw_pci_cqe_sdq_handle':
>> ethernet/mellanox/mlxsw/pci.c:646:18: warning: unused variable 'pdev' [-Wunused-variable]
>> ethernet/mellanox/mlxsw/pci.c: In function 'mlxsw_pci_cqe_rdq_handle':
>> ethernet/mellanox/mlxsw/pci.c:671:18: warning: unused variable 'pdev' [-Wunused-variable]
>> 
>> This changes the mlxsw driver to remove the local variables we get
>> warnings for and instead pass the device directly into the API.
> 
> Hi Arnd
> 
> Would it not be better to fix the macro?
> 
> I think the issue is that dev_dbg_ratelimited calls no_printk(),
> without making use of dev. So how about:
> 
> #define dev_dbg_ratelimited(dev, fmt, ...)                              \
> ({                                                                      \
>         if (0)                                                          \
>                 dev_printk(KERN_DEBUG, dev, fmt, ##__VA_ARGS__);        \
> })
> 
> This follows the pattern for other macros for when DEBUG is not defined.

Yeah, this is probably a better way to fix this problem.

Back to linux.kernel | Previous | NextPrevious in thread | Next in thread | Find similar | Unroll thread


Thread

[PATCH] net: mlxsw: avoid unused variable warnings Arnd Bergmann <arnd@arndb.de> - 2016-03-23 17:40 +0100
  Re: [PATCH] net: mlxsw: avoid unused variable warnings Andrew Lunn <andrew@lunn.ch> - 2016-03-23 18:00 +0100
    Re: [PATCH] net: mlxsw: avoid unused variable warnings David Miller <davem@davemloft.net> - 2016-03-23 19:40 +0100
      Re: [PATCH] net: mlxsw: avoid unused variable warnings Arnd Bergmann <arnd@arndb.de> - 2016-03-24 14:20 +0100

csiph-web