[PATCH] fbdev: Use vmalloc_array to simplify code

Qianfeng Rong rongqianfeng at vivo.com
Mon Aug 4 07:24:11 UTC 2025


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

Compile-tested only.

Signed-off-by: Qianfeng Rong <rongqianfeng at vivo.com>
---
 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



More information about the dri-devel mailing list