[PATCH] fbdev: Use vmalloc_array to simplify code

Subsystems: framebuffer layer, the rest, xen hypervisor interface

STALE436d

2 messages, 2 authors, 2025-08-08 · open the first message on its own page

[PATCH] fbdev: Use vmalloc_array to simplify code

From: Qianfeng Rong <hidden>
Date: 2025-08-04 07:24:29

Use vmalloc_array() instead of vmalloc() to simplify the function
xenfb_probe().

Compile-tested only.

Signed-off-by: Qianfeng Rong <redacted>
---
 drivers/video/fbdev/xen-fbfront.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/drivers/video/fbdev/xen-fbfront.c b/drivers/video/fbdev/xen-fbfront.c
index c90f48ebb15e..d8f3bfb2dd6c 100644
--- a/drivers/video/fbdev/xen-fbfront.c
+++ b/drivers/video/fbdev/xen-fbfront.c
@@ -390,7 +390,7 @@ static int xenfb_probe(struct xenbus_device *dev,
 
 	info->nr_pages = (fb_size + PAGE_SIZE - 1) >> PAGE_SHIFT;
 
-	info->gfns = vmalloc(array_size(sizeof(unsigned long), info->nr_pages));
+	info->gfns = vmalloc_array(info->nr_pages, sizeof(unsigned long));
 	if (!info->gfns)
 		goto error_nomem;
 
-- 
2.34.1

Re: [PATCH] fbdev: Use vmalloc_array to simplify code

From: Helge Deller <deller@gmx.de>
Date: 2025-08-08 08:54:35

On 8/4/25 09:24, Qianfeng Rong wrote:
Use vmalloc_array() instead of vmalloc() to simplify the function
xenfb_probe().

Compile-tested only.

Signed-off-by: Qianfeng Rong <redacted>
---
  drivers/video/fbdev/xen-fbfront.c | 2 +-
  1 file changed, 1 insertion(+), 1 deletion(-)
applied.
Thanks!
Helge
Keyboard shortcuts
hback out one level
jnext message in thread
kprevious message in thread
ldrill in
Escclose help / fold thread tree
?toggle this help