Re: [PATCH] staging: fix macros with multiple statements in rtl8723bs/core/rtw_security.c

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

 



On Sun, May 07, 2017 at 06:23:14PM +0800, Jamie Huang wrote:
> On Sat, 6 May 2017 20:20:57 -0700
> Greg KH <gregkh@xxxxxxxxxxxxxxxxxxx> wrote:
> 
> > On Fri, May 05, 2017 at 02:00:43AM +0800, Jamie Huang wrote:
> > > ERROR: Macros with multiple statements should be enclosed in a do -
> > > while loop Detected by scripts/checkpatch.pl -f
> > > 
> > > Signed-off-by: Jamie Huang <jamienstar@xxxxxxx>
> > > ---
> > >  drivers/staging/rtl8723bs/core/rtw_security.c | 34
> > > +++++++++++++++++++-------- 1 file changed, 24 insertions(+), 10
> > > deletions(-)
> > > 
> > > diff --git a/drivers/staging/rtl8723bs/core/rtw_security.c
> > > b/drivers/staging/rtl8723bs/core/rtw_security.c index
> > > e832f16..c4558db 100644 ---
> > > a/drivers/staging/rtl8723bs/core/rtw_security.c +++
> > > b/drivers/staging/rtl8723bs/core/rtw_security.c @@ -38,52 +38,64 @@
> > > const char *security_type_str(u8 value) 
> > >  #ifdef DBG_SW_SEC_CNT
> > >  #define WEP_SW_ENC_CNT_INC(sec, ra) \
> > > +do {	\
> > >  	if (is_broadcast_mac_addr(ra)) \
> > >  		sec->wep_sw_enc_cnt_bc++; \
> > >  	else if (is_multicast_mac_addr(ra)) \
> > >  		sec->wep_sw_enc_cnt_mc++; \
> > >  	else \
> > > -		sec->wep_sw_enc_cnt_uc++;
> > > +		sec->wep_sw_enc_cnt_uc++; \
> > > +} while (0)  
> > 
> > Ick, these are horrible, can you just make them an inline function
> > instead?
> > 
> > thanks,
> > 
> > greg k-h
> 
> Thank you for reply. Inline function may be a better choice. Does this
> mean that we should use inline instead of do-while macro in new kernel
> source code?

It all depends on the context :)
_______________________________________________
devel mailing list
devel@xxxxxxxxxxxxxxxxxxxxxx
http://driverdev.linuxdriverproject.org/mailman/listinfo/driverdev-devel



[Index of Archives]     [Linux Driver Backports]     [DMA Engine]     [Linux GPIO]     [Linux SPI]     [Video for Linux]     [Linux USB Devel]     [Linux Coverity]     [Linux Audio Users]     [Linux Kernel]     [Linux SCSI]     [Yosemite Backpacking]
  Powered by Linux