[PATCH] staging: media: atomisp: refactor sizeof(struct type) to sizeof(*ptr)
From: Anubhav Kokane
Date: Mon Jan 12 2026 - 14:01:30 EST
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@xxxxxxxxx>
---
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