lkml.org 
[lkml]   [2022]   [Jul]   [17]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
 
Messages in this thread
/
SubjectRe: [PATCH] iio: Use parens with sizeof
From
Date
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

\
 
 \ /
  Last update: 2022-07-17 19:09    [W:0.070 / U:0.060 seconds]
©2003-2020 Jasper Spaans|hosted at Digital Ocean and TransIP|Read the blog|Advertise on this site