Re: [PATCH 3/3] staging: iio: ad7780: Add parentheses to macros

Vladimir Petrigo
2019-03-21T21:12:46Z

On Wed, Mar 20, 2019 at 10:42:17AM +0300, Dan Carpenter wrote:
> On Sun, Mar 17, 2019 at 11:53:12PM +0300, Vladimir Petrigo wrote:
> > - Fix CHECK Macro argument 'wordsize' may be better as '(wordsize)' to avoid precedence issues
> > - Fix CHECK Macro argument reuse 'bits' - possible side-effects?
> >
> > Signed-off-by: Vladimir Petrigo <vladimir.petrigo@gmail.com>
> > ---
> > drivers/staging/iio/adc/ad7780.c | 2 +-
> > 1 file changed, 1 insertion(+), 1 deletion(-)
> >
> > diff --git a/drivers/staging/iio/adc/ad7780.c b/drivers/staging/iio/adc/ad7780.c
> > index c4a8578..2dfd6f8 100644
> > --- a/drivers/staging/iio/adc/ad7780.c
> > +++ b/drivers/staging/iio/adc/ad7780.c
> > @@ -142,7 +142,7 @@ static const struct ad_sigma_delta_info ad7780_sigma_delta_info = {
> > };
> >
> > #define AD7780_CHANNEL(bits, wordsize) \
> > - AD_SD_CHANNEL_NO_SAMP_FREQ(1, 0, 0, bits, 32, wordsize - bits)
> > + AD_SD_CHANNEL_NO_SAMP_FREQ(1, 0, 0, (bits), 32, ((wordsize) - (bits)))
> ^^^^^^
> These parentheses are not required.
>
> This doesn't fix the "argument reuse" issue... It's not a reall issue
> though, and it isn't like this a core macro so it doesn't really matter
> too much.
>
> regards,
> dan carpenter
>
Thank you for the reply. I'll get rid of that parentheses in the v2

Best regards,
Vladimir Petrigo