aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/video
diff options
context:
space:
mode:
authorYoann Padioleau <padator@wanadoo.fr>2007-07-19 04:49:03 -0400
committerLinus Torvalds <torvalds@woody.linux-foundation.org>2007-07-19 13:04:50 -0400
commitdd00cc486ab1c17049a535413d1751ef3482141c (patch)
treed90ff69ea06792b9284f2f2665c96624f121b88a /drivers/video
parent3b5ad0797c0e4049001f961a8b58f1d0ce532072 (diff)
some kmalloc/memset ->kzalloc (tree wide)
Transform some calls to kmalloc/memset to a single kzalloc (or kcalloc). Here is a short excerpt of the semantic patch performing this transformation: @@ type T2; expression x; identifier f,fld; expression E; expression E1,E2; expression e1,e2,e3,y; statement S; @@ x = - kmalloc + kzalloc (E1,E2) ... when != \(x->fld=E;\|y=f(...,x,...);\|f(...,x,...);\|x=E;\|while(...) S\|for(e1;e2;e3) S\) - memset((T2)x,0,E1); @@ expression E1,E2,E3; @@ - kzalloc(E1 * E2,E3) + kcalloc(E1,E2,E3) [akpm@linux-foundation.org: get kcalloc args the right way around] Signed-off-by: Yoann Padioleau <padator@wanadoo.fr> Cc: Richard Henderson <rth@twiddle.net> Cc: Ivan Kokshaysky <ink@jurassic.park.msu.ru> Acked-by: Russell King <rmk@arm.linux.org.uk> Cc: Bryan Wu <bryan.wu@analog.com> Acked-by: Jiri Slaby <jirislaby@gmail.com> Cc: Dave Airlie <airlied@linux.ie> Acked-by: Roland Dreier <rolandd@cisco.com> Cc: Jiri Kosina <jkosina@suse.cz> Acked-by: Dmitry Torokhov <dtor@mail.ru> Cc: Benjamin Herrenschmidt <benh@kernel.crashing.org> Acked-by: Mauro Carvalho Chehab <mchehab@infradead.org> Acked-by: Pierre Ossman <drzeus-list@drzeus.cx> Cc: Jeff Garzik <jeff@garzik.org> Cc: "David S. Miller" <davem@davemloft.net> Acked-by: Greg KH <greg@kroah.com> Cc: James Bottomley <James.Bottomley@steeleye.com> Cc: "Antonino A. Daplas" <adaplas@pol.net> Signed-off-by: Andrew Morton <akpm@linux-foundation.org> Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
Diffstat (limited to 'drivers/video')
-rw-r--r--drivers/video/amba-clcd.c3
-rw-r--r--drivers/video/aty/atyfb_base.c3
-rw-r--r--drivers/video/au1200fb.c3
-rw-r--r--drivers/video/clps711xfb.c3
-rw-r--r--drivers/video/cyber2000fb.c3
-rw-r--r--drivers/video/pvr2fb.c3
-rw-r--r--drivers/video/savage/savagefb_driver.c3
-rw-r--r--drivers/video/valkyriefb.c3
8 files changed, 8 insertions, 16 deletions
diff --git a/drivers/video/amba-clcd.c b/drivers/video/amba-clcd.c
index 6c9dc2e69c82..a7a1c891bfa2 100644
--- a/drivers/video/amba-clcd.c
+++ b/drivers/video/amba-clcd.c
@@ -447,13 +447,12 @@ static int clcdfb_probe(struct amba_device *dev, void *id)
447 goto out; 447 goto out;
448 } 448 }
449 449
450 fb = kmalloc(sizeof(struct clcd_fb), GFP_KERNEL); 450 fb = kzalloc(sizeof(struct clcd_fb), GFP_KERNEL);
451 if (!fb) { 451 if (!fb) {
452 printk(KERN_INFO "CLCD: could not allocate new clcd_fb struct\n"); 452 printk(KERN_INFO "CLCD: could not allocate new clcd_fb struct\n");
453 ret = -ENOMEM; 453 ret = -ENOMEM;
454 goto free_region; 454 goto free_region;
455 } 455 }
456 memset(fb, 0, sizeof(struct clcd_fb));
457 456
458 fb->dev = dev; 457 fb->dev = dev;
459 fb->board = board; 458 fb->board = board;
diff --git a/drivers/video/aty/atyfb_base.c b/drivers/video/aty/atyfb_base.c
index ef330e34d031..0c7bf75732ea 100644
--- a/drivers/video/aty/atyfb_base.c
+++ b/drivers/video/aty/atyfb_base.c
@@ -2937,12 +2937,11 @@ static int __devinit atyfb_setup_sparc(struct pci_dev *pdev,
2937 /* nothing */ ; 2937 /* nothing */ ;
2938 j = i + 4; 2938 j = i + 4;
2939 2939
2940 par->mmap_map = kmalloc(j * sizeof(*par->mmap_map), GFP_ATOMIC); 2940 par->mmap_map = kcalloc(j, sizeof(*par->mmap_map), GFP_ATOMIC);
2941 if (!par->mmap_map) { 2941 if (!par->mmap_map) {
2942 PRINTKE("atyfb_setup_sparc() can't alloc mmap_map\n"); 2942 PRINTKE("atyfb_setup_sparc() can't alloc mmap_map\n");
2943 return -ENOMEM; 2943 return -ENOMEM;
2944 } 2944 }
2945 memset(par->mmap_map, 0, j * sizeof(*par->mmap_map));
2946 2945
2947 for (i = 0, j = 2; i < 6 && pdev->resource[i].start; i++) { 2946 for (i = 0, j = 2; i < 6 && pdev->resource[i].start; i++) {
2948 struct resource *rp = &pdev->resource[i]; 2947 struct resource *rp = &pdev->resource[i];
diff --git a/drivers/video/au1200fb.c b/drivers/video/au1200fb.c
index dbf4ec3f6d57..03e57ef88378 100644
--- a/drivers/video/au1200fb.c
+++ b/drivers/video/au1200fb.c
@@ -1589,11 +1589,10 @@ static int au1200fb_init_fbinfo(struct au1200fb_device *fbdev)
1589 return -EFAULT; 1589 return -EFAULT;
1590 } 1590 }
1591 1591
1592 fbi->pseudo_palette = kmalloc(sizeof(u32) * 16, GFP_KERNEL); 1592 fbi->pseudo_palette = kcalloc(16, sizeof(u32), GFP_KERNEL);
1593 if (!fbi->pseudo_palette) { 1593 if (!fbi->pseudo_palette) {
1594 return -ENOMEM; 1594 return -ENOMEM;
1595 } 1595 }
1596 memset(fbi->pseudo_palette, 0, sizeof(u32) * 16);
1597 1596
1598 if (fb_alloc_cmap(&fbi->cmap, AU1200_LCD_NBR_PALETTE_ENTRIES, 0) < 0) { 1597 if (fb_alloc_cmap(&fbi->cmap, AU1200_LCD_NBR_PALETTE_ENTRIES, 0) < 0) {
1599 print_err("Fail to allocate colormap (%d entries)", 1598 print_err("Fail to allocate colormap (%d entries)",
diff --git a/drivers/video/clps711xfb.c b/drivers/video/clps711xfb.c
index 50b78af0fa24..dea6579941b7 100644
--- a/drivers/video/clps711xfb.c
+++ b/drivers/video/clps711xfb.c
@@ -366,11 +366,10 @@ int __init clps711xfb_init(void)
366 if (fb_get_options("clps711xfb", NULL)) 366 if (fb_get_options("clps711xfb", NULL))
367 return -ENODEV; 367 return -ENODEV;
368 368
369 cfb = kmalloc(sizeof(*cfb), GFP_KERNEL); 369 cfb = kzalloc(sizeof(*cfb), GFP_KERNEL);
370 if (!cfb) 370 if (!cfb)
371 goto out; 371 goto out;
372 372
373 memset(cfb, 0, sizeof(*cfb));
374 strcpy(cfb->fix.id, "clps711x"); 373 strcpy(cfb->fix.id, "clps711x");
375 374
376 cfb->fbops = &clps7111fb_ops; 375 cfb->fbops = &clps7111fb_ops;
diff --git a/drivers/video/cyber2000fb.c b/drivers/video/cyber2000fb.c
index 7a6eeda5ae9a..30ede6e8830f 100644
--- a/drivers/video/cyber2000fb.c
+++ b/drivers/video/cyber2000fb.c
@@ -1221,11 +1221,10 @@ cyberpro_alloc_fb_info(unsigned int id, char *name)
1221{ 1221{
1222 struct cfb_info *cfb; 1222 struct cfb_info *cfb;
1223 1223
1224 cfb = kmalloc(sizeof(struct cfb_info), GFP_KERNEL); 1224 cfb = kzalloc(sizeof(struct cfb_info), GFP_KERNEL);
1225 if (!cfb) 1225 if (!cfb)
1226 return NULL; 1226 return NULL;
1227 1227
1228 memset(cfb, 0, sizeof(struct cfb_info));
1229 1228
1230 cfb->id = id; 1229 cfb->id = id;
1231 1230
diff --git a/drivers/video/pvr2fb.c b/drivers/video/pvr2fb.c
index 0f88c30f94f8..f9300266044d 100644
--- a/drivers/video/pvr2fb.c
+++ b/drivers/video/pvr2fb.c
@@ -1082,13 +1082,12 @@ static int __init pvr2fb_init(void)
1082#endif 1082#endif
1083 size = sizeof(struct fb_info) + sizeof(struct pvr2fb_par) + 16 * sizeof(u32); 1083 size = sizeof(struct fb_info) + sizeof(struct pvr2fb_par) + 16 * sizeof(u32);
1084 1084
1085 fb_info = kmalloc(size, GFP_KERNEL); 1085 fb_info = kzalloc(size, GFP_KERNEL);
1086 if (!fb_info) { 1086 if (!fb_info) {
1087 printk(KERN_ERR "Failed to allocate memory for fb_info\n"); 1087 printk(KERN_ERR "Failed to allocate memory for fb_info\n");
1088 return -ENOMEM; 1088 return -ENOMEM;
1089 } 1089 }
1090 1090
1091 memset(fb_info, 0, size);
1092 1091
1093 currentpar = (struct pvr2fb_par *)(fb_info + 1); 1092 currentpar = (struct pvr2fb_par *)(fb_info + 1);
1094 1093
diff --git a/drivers/video/savage/savagefb_driver.c b/drivers/video/savage/savagefb_driver.c
index 3d7507ad55f6..b855f4a34afe 100644
--- a/drivers/video/savage/savagefb_driver.c
+++ b/drivers/video/savage/savagefb_driver.c
@@ -2174,11 +2174,10 @@ static int __devinit savage_init_fb_info(struct fb_info *info,
2174 2174
2175#if defined(CONFIG_FB_SAVAGE_ACCEL) 2175#if defined(CONFIG_FB_SAVAGE_ACCEL)
2176 /* FIFO size + padding for commands */ 2176 /* FIFO size + padding for commands */
2177 info->pixmap.addr = kmalloc(8*1024, GFP_KERNEL); 2177 info->pixmap.addr = kcalloc(8, 1024, GFP_KERNEL);
2178 2178
2179 err = -ENOMEM; 2179 err = -ENOMEM;
2180 if (info->pixmap.addr) { 2180 if (info->pixmap.addr) {
2181 memset(info->pixmap.addr, 0, 8*1024);
2182 info->pixmap.size = 8*1024; 2181 info->pixmap.size = 8*1024;
2183 info->pixmap.scan_align = 4; 2182 info->pixmap.scan_align = 4;
2184 info->pixmap.buf_align = 4; 2183 info->pixmap.buf_align = 4;
diff --git a/drivers/video/valkyriefb.c b/drivers/video/valkyriefb.c
index ad66f070acb8..7b0cef9ca8f9 100644
--- a/drivers/video/valkyriefb.c
+++ b/drivers/video/valkyriefb.c
@@ -356,10 +356,9 @@ int __init valkyriefb_init(void)
356 } 356 }
357#endif /* ppc (!CONFIG_MAC) */ 357#endif /* ppc (!CONFIG_MAC) */
358 358
359 p = kmalloc(sizeof(*p), GFP_ATOMIC); 359 p = kzalloc(sizeof(*p), GFP_ATOMIC);
360 if (p == 0) 360 if (p == 0)
361 return -ENOMEM; 361 return -ENOMEM;
362 memset(p, 0, sizeof(*p));
363 362
364 /* Map in frame buffer and registers */ 363 /* Map in frame buffer and registers */
365 if (!request_mem_region(frame_buffer_phys, 0x100000, "valkyriefb")) { 364 if (!request_mem_region(frame_buffer_phys, 0x100000, "valkyriefb")) {