Commit 716fae62 authored by Arnd Bergmann's avatar Arnd Bergmann Committed by Greg Kroah-Hartman

driver-core: use 'dev' argument in dev_dbg_ratelimited stub

commit 1f62ff34 upstream.

dev_dbg_ratelimited() is a macro that ignores its first argument 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]

The macro already ensures that all its other arguments are silently
ignored by the compiler without triggering a warning, through the
use of the no_printk() macro, but the dev argument is not passed into
that.

This changes the definition to use the same trick as no_printk() with
an if(0) that leads the compiler to not evaluate the side-effects but
still see that 'dev' might not be unused.
Signed-off-by: default avatarArnd Bergmann <arnd@arndb.de>
Suggested-by: default avatarAndrew Lunn <andrew@lunn.ch>
Fixes: 6f586e66 ("driver-core: Shut up dev_dbg_reatelimited() without DEBUG")
Reviewed-by: default avatarDmitry Torokhov <dmitry.torokhov@gmail.com>
Signed-off-by: default avatarGreg Kroah-Hartman <gregkh@linuxfoundation.org>
parent f290b26f
...@@ -1273,7 +1273,10 @@ do { \ ...@@ -1273,7 +1273,10 @@ do { \
} while (0) } while (0)
#else #else
#define dev_dbg_ratelimited(dev, fmt, ...) \ #define dev_dbg_ratelimited(dev, fmt, ...) \
no_printk(KERN_DEBUG pr_fmt(fmt), ##__VA_ARGS__) do { \
if (0) \
dev_printk(KERN_DEBUG, dev, fmt, ##__VA_ARGS__); \
} while (0)
#endif #endif
#ifdef VERBOSE_DEBUG #ifdef VERBOSE_DEBUG
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment