[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <20201102154831.7a1b7140@kicinski-fedora-PC1C0HJN.hsd1.ca.comcast.net>
Date: Mon, 2 Nov 2020 15:48:31 -0800
From: Jakub Kicinski <kuba@...nel.org>
To: Andrew Lunn <andrew@...n.ch>
Cc: netdev <netdev@...r.kernel.org>, Nicolas Pitre <nico@...xnic.net>
Subject: Re: [PATCH net-next 4/7] drivers: net: smc911x: Fix set but unused
status because of DBG macro
On Sat, 31 Oct 2020 01:49:55 +0100 Andrew Lunn wrote:
> drivers/net/ethernet/smsc/smc911x.c: In function ‘smc911x_timeout’:
> drivers/net/ethernet/smsc/smc911x.c:1251:6: warning: variable ‘status’ set but not used [-Wunused-but-set-variable]
> 1251 | int status, mask;
>
> The status is read in order to print it via the DBG macro. However,
> due to the way DBG is disabled, the compiler never sees it being used.
>
> Change the DBG macro to actually make use of the passed parameters,
> and the leave the optimiser to remove the unwanted code inside the if
> (0).
>
> Signed-off-by: Andrew Lunn <andrew@...n.ch>
> ---
> drivers/net/ethernet/smsc/smc911x.c | 6 +++++-
> 1 file changed, 5 insertions(+), 1 deletion(-)
>
> diff --git a/drivers/net/ethernet/smsc/smc911x.c b/drivers/net/ethernet/smsc/smc911x.c
> index 8f748a0c057e..33d0398c182e 100644
> --- a/drivers/net/ethernet/smsc/smc911x.c
> +++ b/drivers/net/ethernet/smsc/smc911x.c
> @@ -102,7 +102,11 @@ MODULE_ALIAS("platform:smc911x");
>
> #define PRINTK(dev, args...) netdev_info(dev, args)
> #else
> -#define DBG(n, dev, args...) do { } while (0)
> +#define DBG(n, dev, args...) \
> + do { \
> + if (0) \
> + netdev_dbg(dev, args); \
> + } while (0)
nit: since you have to respin - while (0) { } would do here.
Powered by blists - more mailing lists