public inbox for linux-kernel@vger.kernel.org
 help / color / mirror / Atom feed
From: Joe Simmons-Talbott <joetalbott@gmail.com>
To: Joe Perches <joe@perches.com>
Cc: Jonathan Cameron <jic23@kernel.org>,
	Lars-Peter Clausen <lars@metafoo.de>,
	linux-iio@vger.kernel.org, linux-kernel@vger.kernel.org
Subject: Re: [PATCH] iio: Use parens with sizeof
Date: Sun, 17 Jul 2022 16:08:27 -0400	[thread overview]
Message-ID: <YtRsO7cLyDIH47od@spruce> (raw)
In-Reply-To: <59c0003bfc5b429a8e39151da942fcaf707109a0.camel@perches.com>

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?

Thanks,
Joe

  reply	other threads:[~2022-07-17 20:08 UTC|newest]

Thread overview: 5+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2022-07-17 15:34 [PATCH] iio: Use parens with sizeof Joe Simmons-Talbott
2022-07-17 17:08 ` Joe Perches
2022-07-17 20:08   ` Joe Simmons-Talbott [this message]
2022-07-18  1:25     ` Joe Perches
2022-07-31 11:30 ` Jonathan Cameron

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=YtRsO7cLyDIH47od@spruce \
    --to=joetalbott@gmail.com \
    --cc=jic23@kernel.org \
    --cc=joe@perches.com \
    --cc=lars@metafoo.de \
    --cc=linux-iio@vger.kernel.org \
    --cc=linux-kernel@vger.kernel.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox