Message ID | ce2233a7-e470-0fc2-f908-75f52c6ec3e1@infradead.org (mailing list archive) |
---|---|
State | Superseded |
Headers | show |
Series | fusion: fix if-statement empty body warning | expand |
On 2/27/20 6:12 PM, Randy Dunlap wrote: > From: Randy Dunlap <rdunlap@infradead.org> > > When driver debugging is not enabled, make the debug print macros > be empty do-while loops. > > This fixes a gcc warning when -Wextra is set: > ../drivers/message/fusion/mptlan.c:266:39: warning: suggest braces around empty body in an ‘else’ statement [-Wempty-body] > > I have verified that there is no object code change (with gcc 7.5.0). Hi, Would you (anyone) rather see something different here, such as using pr_debug() or no_printk() instead of an empty do-while loop? I went with a minimal change, but I can do something else if that is preferred. > Signed-off-by: Randy Dunlap <rdunlap@infradead.org> > Cc: Sathya Prakash <sathya.prakash@broadcom.com> > Cc: Chaitra P B <chaitra.basappa@broadcom.com> > Cc: Suganath Prabu Subramani <suganath-prabu.subramani@broadcom.com> > Cc: MPT-FusionLinux.pdl@broadcom.com > Cc: linux-scsi@vger.kernel.org > Cc: "Martin K. Petersen" <martin.petersen@oracle.com> > Cc: "James E.J. Bottomley" <jejb@linux.ibm.com> > --- > drivers/message/fusion/mptlan.h | 4 ++-- > 1 file changed, 2 insertions(+), 2 deletions(-) > > --- linux-next-20200225.orig/drivers/message/fusion/mptlan.h > +++ linux-next-20200225/drivers/message/fusion/mptlan.h > @@ -111,13 +111,13 @@ MODULE_DESCRIPTION(LANAME); > #ifdef MPT_LAN_IO_DEBUG > #define dioprintk(x) printk x > #else > -#define dioprintk(x) > +#define dioprintk(x) do {} while (0) > #endif > > #ifdef MPT_LAN_DEBUG > #define dlprintk(x) printk x > #else > -#define dlprintk(x) > +#define dlprintk(x) do {} while (0) > #endif > > #define NETDEV_TO_LANPRIV_PTR(d) ((struct mpt_lan_priv *)netdev_priv(d)) > thanks.
On 2020-03-07 18:10, Randy Dunlap wrote: > Would you (anyone) rather see something different here, > such as using pr_debug() or no_printk() instead of an > empty do-while loop? > > I went with a minimal change, but I can do something else > if that is preferred. If "do {} while(0)" is changed into "no_printk x", feel free to add the following: Reviewed-by: Bart van Assche <bvanassche@acm.org>
--- linux-next-20200225.orig/drivers/message/fusion/mptlan.h +++ linux-next-20200225/drivers/message/fusion/mptlan.h @@ -111,13 +111,13 @@ MODULE_DESCRIPTION(LANAME); #ifdef MPT_LAN_IO_DEBUG #define dioprintk(x) printk x #else -#define dioprintk(x) +#define dioprintk(x) do {} while (0) #endif #ifdef MPT_LAN_DEBUG #define dlprintk(x) printk x #else -#define dlprintk(x) +#define dlprintk(x) do {} while (0) #endif #define NETDEV_TO_LANPRIV_PTR(d) ((struct mpt_lan_priv *)netdev_priv(d))