Re: [PATCH] fusion: fix if-statement empty body warning

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



On 2/27/20 6:12 PM, Randy Dunlap wrote:
> From: Randy Dunlap <rdunlap@xxxxxxxxxxxxx>
> 
> 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@xxxxxxxxxxxxx>
> Cc: Sathya Prakash <sathya.prakash@xxxxxxxxxxxx>
> Cc: Chaitra P B <chaitra.basappa@xxxxxxxxxxxx>
> Cc: Suganath Prabu Subramani <suganath-prabu.subramani@xxxxxxxxxxxx>
> Cc: MPT-FusionLinux.pdl@xxxxxxxxxxxx
> Cc: linux-scsi@xxxxxxxxxxxxxxx
> Cc: "Martin K. Petersen" <martin.petersen@xxxxxxxxxx>
> Cc: "James E.J. Bottomley" <jejb@xxxxxxxxxxxxx>
> ---
>  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.
-- 
~Randy




[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[Index of Archives]     [SCSI Target Devel]     [Linux SCSI Target Infrastructure]     [Kernel Newbies]     [IDE]     [Security]     [Git]     [Netfilter]     [Bugtraq]     [Yosemite News]     [MIPS Linux]     [ARM Linux]     [Linux Security]     [Linux RAID]     [Linux ATA RAID]     [Linux IIO]     [Samba]     [Device Mapper]

  Powered by Linux