[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-Id: <20251021143122.268730-4-tanze@kylinos.cn>
Date: Tue, 21 Oct 2025 22:31:22 +0800
From: tanze <tanze@...inos.cn>
To: mchehab@...nel.org,
mingo@...nel.org,
hverkuil@...nel.org,
tskd08@...il.com
Cc: linux-media@...r.kernel.org,
linux-kernel@...r.kernel.org,
tanze <tanze@...inos.cn>
Subject: [PATCH 3/3] media: pt1: Optimize the code using vmalloc_array
Change array_size() to vmalloc_array(), Due to vmalloc_array() is optimized better,
uses fewer instructions, and handles overflow more concisely
Signed-off-by: tanze <tanze@...inos.cn>
---
drivers/media/pci/pt1/pt1.c | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/drivers/media/pci/pt1/pt1.c b/drivers/media/pci/pt1/pt1.c
index 121a4a92ea10..963fa5e13d33 100644
--- a/drivers/media/pci/pt1/pt1.c
+++ b/drivers/media/pci/pt1/pt1.c
@@ -639,7 +639,7 @@ static int pt1_init_tables(struct pt1 *pt1)
if (!pt1_nr_tables)
return 0;
- tables = vmalloc(array_size(pt1_nr_tables, sizeof(struct pt1_table)));
+ tables = vmalloc_array(sizeof(struct pt1_table), pt1_nr_tables);
if (tables == NULL)
return -ENOMEM;
--
2.25.1
Powered by blists - more mailing lists