From: Anubhav Kokane <dev.anubhavk@gmail.com>
To: hansg@kernel.org, mchehab@kernel.org, andy@kernel.org
Cc: sakari.ailus@linux.intel.com, gregkh@linuxfoundation.org,
linux-media@vger.kernel.org, linux-staging@lists.linux.dev,
linux-kernel@vger.kernel.org,
Anubhav Kokane <dev.anubhavk@gmail.com>
Subject: [PATCH] staging: media: atomisp: refactor sizeof(struct type) to sizeof(*ptr)
Date: Mon, 12 Jan 2026 19:00:53 +0000 [thread overview]
Message-ID: <20260112190054.9828-1-dev.anubhavk@gmail.com> (raw)
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)...)"
Signed-off-by: Anubhav Kokane <dev.anubhavk@gmail.com>
---
drivers/staging/media/atomisp/pci/atomisp_ioctl.c | 6 +++---
1 file changed, 3 insertions(+), 3 deletions(-)
diff --git a/drivers/staging/media/atomisp/pci/atomisp_ioctl.c b/drivers/staging/media/atomisp/pci/atomisp_ioctl.c
index bb8b2f2213b0..60f705fac3c7 100644
--- a/drivers/staging/media/atomisp/pci/atomisp_ioctl.c
+++ b/drivers/staging/media/atomisp/pci/atomisp_ioctl.c
@@ -696,7 +696,7 @@ int atomisp_alloc_css_stat_bufs(struct atomisp_sub_device *asd,
ATOMISP_S3A_BUF_QUEUE_DEPTH_FOR_HAL;
dev_dbg(isp->dev, "allocating %d 3a buffers\n", count);
while (count--) {
- s3a_buf = kzalloc(sizeof(struct atomisp_s3a_buf), GFP_KERNEL);
+ s3a_buf = kzalloc(sizeof(*s3a_buf), GFP_KERNEL);
if (!s3a_buf)
goto error;
@@ -715,7 +715,7 @@ int atomisp_alloc_css_stat_bufs(struct atomisp_sub_device *asd,
count = ATOMISP_CSS_Q_DEPTH + 1;
dev_dbg(isp->dev, "allocating %d dis buffers\n", count);
while (count--) {
- dis_buf = kzalloc(sizeof(struct atomisp_dis_buf), GFP_KERNEL);
+ dis_buf = kzalloc(sizeof(*dis_buf), GFP_KERNEL);
if (!dis_buf)
goto error;
if (atomisp_css_allocate_stat_buffers(
@@ -737,7 +737,7 @@ int atomisp_alloc_css_stat_bufs(struct atomisp_sub_device *asd,
dev_dbg(isp->dev, "allocating %d metadata buffers for type %d\n",
count, i);
while (count--) {
- md_buf = kzalloc(sizeof(struct atomisp_metadata_buf),
+ md_buf = kzalloc(sizeof(*md_buf),
GFP_KERNEL);
if (!md_buf)
goto error;
--
2.43.0
next reply other threads:[~2026-01-12 19:01 UTC|newest]
Thread overview: 6+ messages / expand[flat|nested] mbox.gz Atom feed top
2026-01-12 19:00 Anubhav Kokane [this message]
2026-01-12 19:14 ` [PATCH] staging: media: atomisp: refactor sizeof(struct type) to sizeof(*ptr) Andy Shevchenko
2026-01-13 10:37 ` Anubhav Kokane
2026-01-13 10:45 ` Andy Shevchenko
2026-01-13 16:08 ` Anubhav Kokane
2026-01-15 11:21 ` Anubhav Kokane
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=20260112190054.9828-1-dev.anubhavk@gmail.com \
--to=dev.anubhavk@gmail.com \
--cc=andy@kernel.org \
--cc=gregkh@linuxfoundation.org \
--cc=hansg@kernel.org \
--cc=linux-kernel@vger.kernel.org \
--cc=linux-media@vger.kernel.org \
--cc=linux-staging@lists.linux.dev \
--cc=mchehab@kernel.org \
--cc=sakari.ailus@linux.intel.com \
/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