[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <75022a03a4d0c8b238dcf1c7b60b5d222b184f34.camel@perches.com>
Date: Sun, 17 Jul 2022 18:25:31 -0700
From: Joe Perches <joe@...ches.com>
To: Joe Simmons-Talbott <joetalbott@...il.com>
Cc: Jonathan Cameron <jic23@...nel.org>,
Lars-Peter Clausen <lars@...afoo.de>,
linux-iio@...r.kernel.org, linux-kernel@...r.kernel.org
Subject: Re: [PATCH] iio: Use parens with sizeof
On Sun, 2022-07-17 at 16:08 -0400, Joe Simmons-Talbott wrote:
> On Sun, Jul 17, 2022 at 10:08:37AM -0700, Joe Perches wrote:
> > On Sun, 2022-07-17 at 11:34 -0400, Joe Simmons-Talbott wrote:
> > > Prefer 'sizeof(var)' over 'sizeof var' as reported by checkpatch.pl.
> >
> > unrelated trivia:
> >
> > > diff --git a/drivers/iio/industrialio-trigger.c b/drivers/iio/industrialio-trigger.c
> > []
> > > @@ -368,7 +368,7 @@ struct iio_poll_func
> > > va_list vargs;
> > > struct iio_poll_func *pf;
> > >
> > > - pf = kmalloc(sizeof *pf, GFP_KERNEL);
> > > + pf = kmalloc(sizeof(*pf), GFP_KERNEL);
> > > if (pf == NULL)
> > > return NULL;
> > > va_start(vargs, fmt);
> > > @@ -560,7 +560,7 @@ struct iio_trigger *viio_trigger_alloc(struct device *parent,
> > > struct iio_trigger *trig;
> > > int i;
> > >
> > > - trig = kzalloc(sizeof *trig, GFP_KERNEL);
> > > + trig = kzalloc(sizeof(*trig), GFP_KERNEL);
> > > if (!trig)
> > > return NULL;
> >
> > It'd be nice to be consistent with the allocation return test.
> >
> > Please pick one of:
> >
> > if (ptr == NULL)
> > or
> > if (!ptr) // my preference
> >
>
> I'm happy to submit a patch for that. Do you want me to include a
> Suggested-by: tag?
Not really.
Powered by blists - more mailing lists