* [PATCH] iio: Use parens with sizeof
@ 2022-07-17 15:34 Joe Simmons-Talbott
2022-07-17 17:08 ` Joe Perches
2022-07-31 11:30 ` Jonathan Cameron
0 siblings, 2 replies; 5+ messages in thread
From: Joe Simmons-Talbott @ 2022-07-17 15:34 UTC (permalink / raw)
To: Jonathan Cameron, Lars-Peter Clausen, linux-iio, linux-kernel
Cc: Joe Simmons-Talbott
Prefer 'sizeof(var)' over 'sizeof var' as reported by checkpatch.pl.
Signed-off-by: Joe Simmons-Talbott <joetalbott@gmail.com>
---
drivers/iio/industrialio-trigger.c | 4 ++--
1 file changed, 2 insertions(+), 2 deletions(-)
diff --git a/drivers/iio/industrialio-trigger.c b/drivers/iio/industrialio-trigger.c
index f504ed351b3e..88bccb0676c8 100644
--- 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;
--
2.35.3
^ permalink raw reply related [flat|nested] 5+ messages in thread
* Re: [PATCH] iio: Use parens with sizeof
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
2022-07-31 11:30 ` Jonathan Cameron
1 sibling, 1 reply; 5+ messages in thread
From: Joe Perches @ 2022-07-17 17:08 UTC (permalink / raw)
To: Joe Simmons-Talbott, Jonathan Cameron, Lars-Peter Clausen,
linux-iio, linux-kernel
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
^ permalink raw reply [flat|nested] 5+ messages in thread
* Re: [PATCH] iio: Use parens with sizeof
2022-07-17 17:08 ` Joe Perches
@ 2022-07-17 20:08 ` Joe Simmons-Talbott
2022-07-18 1:25 ` Joe Perches
0 siblings, 1 reply; 5+ messages in thread
From: Joe Simmons-Talbott @ 2022-07-17 20:08 UTC (permalink / raw)
To: Joe Perches; +Cc: Jonathan Cameron, Lars-Peter Clausen, linux-iio, linux-kernel
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
^ permalink raw reply [flat|nested] 5+ messages in thread
* Re: [PATCH] iio: Use parens with sizeof
2022-07-17 20:08 ` Joe Simmons-Talbott
@ 2022-07-18 1:25 ` Joe Perches
0 siblings, 0 replies; 5+ messages in thread
From: Joe Perches @ 2022-07-18 1:25 UTC (permalink / raw)
To: Joe Simmons-Talbott
Cc: Jonathan Cameron, Lars-Peter Clausen, linux-iio, linux-kernel
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.
^ permalink raw reply [flat|nested] 5+ messages in thread
* Re: [PATCH] iio: Use parens with sizeof
2022-07-17 15:34 [PATCH] iio: Use parens with sizeof Joe Simmons-Talbott
2022-07-17 17:08 ` Joe Perches
@ 2022-07-31 11:30 ` Jonathan Cameron
1 sibling, 0 replies; 5+ messages in thread
From: Jonathan Cameron @ 2022-07-31 11:30 UTC (permalink / raw)
To: Joe Simmons-Talbott; +Cc: Lars-Peter Clausen, linux-iio, linux-kernel
On Sun, 17 Jul 2022 11:34:38 -0400
Joe Simmons-Talbott <joetalbott@gmail.com> wrote:
> Prefer 'sizeof(var)' over 'sizeof var' as reported by checkpatch.pl.
>
> Signed-off-by: Joe Simmons-Talbott <joetalbott@gmail.com>
Applied to the togreg branch of iio.git and pushed out as testing
to let 0-day take a poke at it.
oops. Email got stuck in my outbox when I went away for a week.
Thanks,
Jonathan
> ---
> drivers/iio/industrialio-trigger.c | 4 ++--
> 1 file changed, 2 insertions(+), 2 deletions(-)
>
> diff --git a/drivers/iio/industrialio-trigger.c b/drivers/iio/industrialio-trigger.c
> index f504ed351b3e..88bccb0676c8 100644
> --- 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;
>
^ permalink raw reply [flat|nested] 5+ messages in thread
end of thread, other threads:[~2022-07-31 11:20 UTC | newest]
Thread overview: 5+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
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
2022-07-18 1:25 ` Joe Perches
2022-07-31 11:30 ` Jonathan Cameron
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).