[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <aWVIF_rkHzxs3k-r@smile.fi.intel.com>
Date: Mon, 12 Jan 2026 21:14:31 +0200
From: Andy Shevchenko <andriy.shevchenko@...el.com>
To: Anubhav Kokane <dev.anubhavk@...il.com>
Cc: hansg@...nel.org, mchehab@...nel.org, andy@...nel.org,
sakari.ailus@...ux.intel.com, gregkh@...uxfoundation.org,
linux-media@...r.kernel.org, linux-staging@...ts.linux.dev,
linux-kernel@...r.kernel.org
Subject: Re: [PATCH] staging: media: atomisp: refactor sizeof(struct type) to
sizeof(*ptr)
On Mon, Jan 12, 2026 at 07:00:53PM +0000, Anubhav Kokane wrote:
> Use the variable name in sizeof() operator instead of the struct type.
> This prevents errors if the type of the variable is changed in future.
>
> This fixes checkpatch checks:
> "CHECK: Prefer kzalloc(sizeof(*ptr)...) over
> kzalloc(sizeof(struct type)...)"
Yeah, but in all cases the whole buffers are less than a page and hence instead
of doing that the preferred way is to switch to use kcalloc() in all three
places.
So you should have something like
x = kcalloc(count, sizeof(*...), ...);
if (!x)
...handle error...
while (count--) {
...
}
...
err:
list_for_each... {
...
}
kfree(x);
--
With Best Regards,
Andy Shevchenko
Powered by blists - more mailing lists