diff options
author | Jiri Slaby <jirislaby@gmail.com> | 2007-02-12 03:55:12 -0500 |
---|---|---|
committer | Linus Torvalds <torvalds@woody.linux-foundation.org> | 2007-02-12 12:48:43 -0500 |
commit | f5610b9c3a2896fcaa623b92d0f24d83f10bb2c0 (patch) | |
tree | f4ff35f5991debf0f892794687abc574cdaacb4f /drivers | |
parent | c4f28e54d61278203c2bb2aea0679e0a738235d2 (diff) |
[PATCH] Video: fb, kzalloc changes
Use kzalloc instead of kmalloc + memset(0).
Signed-off-by: Jiri Slaby <jirislaby@gmail.com>
Cc: James Simmons <jsimmons@infradead.org>
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')
-rw-r--r-- | drivers/video/au1100fb.c | 6 | ||||
-rw-r--r-- | drivers/video/controlfb.c | 3 | ||||
-rw-r--r-- | drivers/video/i810/i810_main.c | 3 | ||||
-rw-r--r-- | drivers/video/igafb.c | 7 | ||||
-rw-r--r-- | drivers/video/intelfb/intelfbdrv.c | 3 | ||||
-rw-r--r-- | drivers/video/nvidia/nvidia.c | 4 | ||||
-rw-r--r-- | drivers/video/riva/fbdev.c | 3 |
7 files changed, 9 insertions, 20 deletions
diff --git a/drivers/video/au1100fb.c b/drivers/video/au1100fb.c index ef5c16f7f5a6..80a81eccad36 100644 --- a/drivers/video/au1100fb.c +++ b/drivers/video/au1100fb.c | |||
@@ -468,11 +468,10 @@ int au1100fb_drv_probe(struct device *dev) | |||
468 | return -EINVAL; | 468 | return -EINVAL; |
469 | 469 | ||
470 | /* Allocate new device private */ | 470 | /* Allocate new device private */ |
471 | if (!(fbdev = kmalloc(sizeof(struct au1100fb_device), GFP_KERNEL))) { | 471 | if (!(fbdev = kzalloc(sizeof(struct au1100fb_device), GFP_KERNEL))) { |
472 | print_err("fail to allocate device private record"); | 472 | print_err("fail to allocate device private record"); |
473 | return -ENOMEM; | 473 | return -ENOMEM; |
474 | } | 474 | } |
475 | memset((void*)fbdev, 0, sizeof(struct au1100fb_device)); | ||
476 | 475 | ||
477 | fbdev->panel = &known_lcd_panels[drv_info.panel_idx]; | 476 | fbdev->panel = &known_lcd_panels[drv_info.panel_idx]; |
478 | 477 | ||
@@ -549,10 +548,9 @@ int au1100fb_drv_probe(struct device *dev) | |||
549 | fbdev->info.fbops = &au1100fb_ops; | 548 | fbdev->info.fbops = &au1100fb_ops; |
550 | fbdev->info.fix = au1100fb_fix; | 549 | fbdev->info.fix = au1100fb_fix; |
551 | 550 | ||
552 | if (!(fbdev->info.pseudo_palette = kmalloc(sizeof(u32) * 16, GFP_KERNEL))) { | 551 | if (!(fbdev->info.pseudo_palette = kzalloc(sizeof(u32) * 16, GFP_KERNEL))) { |
553 | return -ENOMEM; | 552 | return -ENOMEM; |
554 | } | 553 | } |
555 | memset(fbdev->info.pseudo_palette, 0, sizeof(u32) * 16); | ||
556 | 554 | ||
557 | if (fb_alloc_cmap(&fbdev->info.cmap, AU1100_LCD_NBR_PALETTE_ENTRIES, 0) < 0) { | 555 | if (fb_alloc_cmap(&fbdev->info.cmap, AU1100_LCD_NBR_PALETTE_ENTRIES, 0) < 0) { |
558 | print_err("Fail to allocate colormap (%d entries)", | 556 | print_err("Fail to allocate colormap (%d entries)", |
diff --git a/drivers/video/controlfb.c b/drivers/video/controlfb.c index 04c6d928189b..fd60dba294da 100644 --- a/drivers/video/controlfb.c +++ b/drivers/video/controlfb.c | |||
@@ -696,11 +696,10 @@ static int __init control_of_init(struct device_node *dp) | |||
696 | printk(KERN_ERR "can't get 2 addresses for control\n"); | 696 | printk(KERN_ERR "can't get 2 addresses for control\n"); |
697 | return -ENXIO; | 697 | return -ENXIO; |
698 | } | 698 | } |
699 | p = kmalloc(sizeof(*p), GFP_KERNEL); | 699 | p = kzalloc(sizeof(*p), GFP_KERNEL); |
700 | if (p == 0) | 700 | if (p == 0) |
701 | return -ENXIO; | 701 | return -ENXIO; |
702 | control_fb = p; /* save it for cleanups */ | 702 | control_fb = p; /* save it for cleanups */ |
703 | memset(p, 0, sizeof(*p)); | ||
704 | 703 | ||
705 | /* Map in frame buffer and registers */ | 704 | /* Map in frame buffer and registers */ |
706 | p->fb_orig_base = fb_res.start; | 705 | p->fb_orig_base = fb_res.start; |
diff --git a/drivers/video/i810/i810_main.c b/drivers/video/i810/i810_main.c index e343c0da9618..29f89db428ce 100644 --- a/drivers/video/i810/i810_main.c +++ b/drivers/video/i810/i810_main.c | |||
@@ -2021,11 +2021,10 @@ static int __devinit i810fb_init_pci (struct pci_dev *dev, | |||
2021 | par = info->par; | 2021 | par = info->par; |
2022 | par->dev = dev; | 2022 | par->dev = dev; |
2023 | 2023 | ||
2024 | if (!(info->pixmap.addr = kmalloc(8*1024, GFP_KERNEL))) { | 2024 | if (!(info->pixmap.addr = kzalloc(8*1024, GFP_KERNEL))) { |
2025 | i810fb_release_resource(info, par); | 2025 | i810fb_release_resource(info, par); |
2026 | return -ENOMEM; | 2026 | return -ENOMEM; |
2027 | } | 2027 | } |
2028 | memset(info->pixmap.addr, 0, 8*1024); | ||
2029 | info->pixmap.size = 8*1024; | 2028 | info->pixmap.size = 8*1024; |
2030 | info->pixmap.buf_align = 8; | 2029 | info->pixmap.buf_align = 8; |
2031 | info->pixmap.access_align = 32; | 2030 | info->pixmap.access_align = 32; |
diff --git a/drivers/video/igafb.c b/drivers/video/igafb.c index 51355c8885aa..90592fb59156 100644 --- a/drivers/video/igafb.c +++ b/drivers/video/igafb.c | |||
@@ -401,12 +401,11 @@ int __init igafb_init(void) | |||
401 | 401 | ||
402 | size = sizeof(struct fb_info) + sizeof(struct iga_par) + sizeof(u32)*16; | 402 | size = sizeof(struct fb_info) + sizeof(struct iga_par) + sizeof(u32)*16; |
403 | 403 | ||
404 | info = kmalloc(size, GFP_ATOMIC); | 404 | info = kzalloc(size, GFP_ATOMIC); |
405 | if (!info) { | 405 | if (!info) { |
406 | printk("igafb_init: can't alloc fb_info\n"); | 406 | printk("igafb_init: can't alloc fb_info\n"); |
407 | return -ENOMEM; | 407 | return -ENOMEM; |
408 | } | 408 | } |
409 | memset(info, 0, size); | ||
410 | 409 | ||
411 | par = (struct iga_par *) (info + 1); | 410 | par = (struct iga_par *) (info + 1); |
412 | 411 | ||
@@ -465,7 +464,7 @@ int __init igafb_init(void) | |||
465 | * one additional region with size == 0. | 464 | * one additional region with size == 0. |
466 | */ | 465 | */ |
467 | 466 | ||
468 | par->mmap_map = kmalloc(4 * sizeof(*par->mmap_map), GFP_ATOMIC); | 467 | par->mmap_map = kzalloc(4 * sizeof(*par->mmap_map), GFP_ATOMIC); |
469 | if (!par->mmap_map) { | 468 | if (!par->mmap_map) { |
470 | printk("igafb_init: can't alloc mmap_map\n"); | 469 | printk("igafb_init: can't alloc mmap_map\n"); |
471 | iounmap((void *)par->io_base); | 470 | iounmap((void *)par->io_base); |
@@ -474,8 +473,6 @@ int __init igafb_init(void) | |||
474 | return -ENOMEM; | 473 | return -ENOMEM; |
475 | } | 474 | } |
476 | 475 | ||
477 | memset(par->mmap_map, 0, 4 * sizeof(*par->mmap_map)); | ||
478 | |||
479 | /* | 476 | /* |
480 | * Set default vmode and cmode from PROM properties. | 477 | * Set default vmode and cmode from PROM properties. |
481 | */ | 478 | */ |
diff --git a/drivers/video/intelfb/intelfbdrv.c b/drivers/video/intelfb/intelfbdrv.c index 664fc5cf962a..b75eda84858f 100644 --- a/drivers/video/intelfb/intelfbdrv.c +++ b/drivers/video/intelfb/intelfbdrv.c | |||
@@ -540,12 +540,11 @@ intelfb_pci_register(struct pci_dev *pdev, const struct pci_device_id *ent) | |||
540 | dinfo->pdev = pdev; | 540 | dinfo->pdev = pdev; |
541 | 541 | ||
542 | /* Reserve pixmap space. */ | 542 | /* Reserve pixmap space. */ |
543 | info->pixmap.addr = kmalloc(64 * 1024, GFP_KERNEL); | 543 | info->pixmap.addr = kzalloc(64 * 1024, GFP_KERNEL); |
544 | if (info->pixmap.addr == NULL) { | 544 | if (info->pixmap.addr == NULL) { |
545 | ERR_MSG("Cannot reserve pixmap memory.\n"); | 545 | ERR_MSG("Cannot reserve pixmap memory.\n"); |
546 | goto err_out_pixmap; | 546 | goto err_out_pixmap; |
547 | } | 547 | } |
548 | memset(info->pixmap.addr, 0, 64 * 1024); | ||
549 | 548 | ||
550 | /* set early this option because it could be changed by tv encoder | 549 | /* set early this option because it could be changed by tv encoder |
551 | driver */ | 550 | driver */ |
diff --git a/drivers/video/nvidia/nvidia.c b/drivers/video/nvidia/nvidia.c index 538e947610e1..f6731dadff3a 100644 --- a/drivers/video/nvidia/nvidia.c +++ b/drivers/video/nvidia/nvidia.c | |||
@@ -1205,13 +1205,11 @@ static int __devinit nvidiafb_probe(struct pci_dev *pd, | |||
1205 | par = info->par; | 1205 | par = info->par; |
1206 | par->pci_dev = pd; | 1206 | par->pci_dev = pd; |
1207 | 1207 | ||
1208 | info->pixmap.addr = kmalloc(8 * 1024, GFP_KERNEL); | 1208 | info->pixmap.addr = kzalloc(8 * 1024, GFP_KERNEL); |
1209 | 1209 | ||
1210 | if (info->pixmap.addr == NULL) | 1210 | if (info->pixmap.addr == NULL) |
1211 | goto err_out_kfree; | 1211 | goto err_out_kfree; |
1212 | 1212 | ||
1213 | memset(info->pixmap.addr, 0, 8 * 1024); | ||
1214 | |||
1215 | if (pci_enable_device(pd)) { | 1213 | if (pci_enable_device(pd)) { |
1216 | printk(KERN_ERR PFX "cannot enable PCI device\n"); | 1214 | printk(KERN_ERR PFX "cannot enable PCI device\n"); |
1217 | goto err_out_enable; | 1215 | goto err_out_enable; |
diff --git a/drivers/video/riva/fbdev.c b/drivers/video/riva/fbdev.c index 7c19b5c2a541..9316905e027a 100644 --- a/drivers/video/riva/fbdev.c +++ b/drivers/video/riva/fbdev.c | |||
@@ -1984,12 +1984,11 @@ static int __devinit rivafb_probe(struct pci_dev *pd, | |||
1984 | default_par = info->par; | 1984 | default_par = info->par; |
1985 | default_par->pdev = pd; | 1985 | default_par->pdev = pd; |
1986 | 1986 | ||
1987 | info->pixmap.addr = kmalloc(8 * 1024, GFP_KERNEL); | 1987 | info->pixmap.addr = kzalloc(8 * 1024, GFP_KERNEL); |
1988 | if (info->pixmap.addr == NULL) { | 1988 | if (info->pixmap.addr == NULL) { |
1989 | ret = -ENOMEM; | 1989 | ret = -ENOMEM; |
1990 | goto err_framebuffer_release; | 1990 | goto err_framebuffer_release; |
1991 | } | 1991 | } |
1992 | memset(info->pixmap.addr, 0, 8 * 1024); | ||
1993 | 1992 | ||
1994 | ret = pci_enable_device(pd); | 1993 | ret = pci_enable_device(pd); |
1995 | if (ret < 0) { | 1994 | if (ret < 0) { |