Commit f5610b9c authored by Jiri Slaby's avatar Jiri Slaby Committed by Linus Torvalds

[PATCH] Video: fb, kzalloc changes

Use kzalloc instead of kmalloc + memset(0).
Signed-off-by: default avatarJiri Slaby <jirislaby@gmail.com>
Cc: James Simmons <jsimmons@infradead.org>
Cc: "Antonino A. Daplas" <adaplas@pol.net>
Signed-off-by: default avatarAndrew Morton <akpm@linux-foundation.org>
Signed-off-by: default avatarLinus Torvalds <torvalds@linux-foundation.org>
parent c4f28e54
...@@ -468,11 +468,10 @@ int au1100fb_drv_probe(struct device *dev) ...@@ -468,11 +468,10 @@ int au1100fb_drv_probe(struct device *dev)
return -EINVAL; return -EINVAL;
/* Allocate new device private */ /* Allocate new device private */
if (!(fbdev = kmalloc(sizeof(struct au1100fb_device), GFP_KERNEL))) { if (!(fbdev = kzalloc(sizeof(struct au1100fb_device), GFP_KERNEL))) {
print_err("fail to allocate device private record"); print_err("fail to allocate device private record");
return -ENOMEM; return -ENOMEM;
} }
memset((void*)fbdev, 0, sizeof(struct au1100fb_device));
fbdev->panel = &known_lcd_panels[drv_info.panel_idx]; fbdev->panel = &known_lcd_panels[drv_info.panel_idx];
...@@ -549,10 +548,9 @@ int au1100fb_drv_probe(struct device *dev) ...@@ -549,10 +548,9 @@ int au1100fb_drv_probe(struct device *dev)
fbdev->info.fbops = &au1100fb_ops; fbdev->info.fbops = &au1100fb_ops;
fbdev->info.fix = au1100fb_fix; fbdev->info.fix = au1100fb_fix;
if (!(fbdev->info.pseudo_palette = kmalloc(sizeof(u32) * 16, GFP_KERNEL))) { if (!(fbdev->info.pseudo_palette = kzalloc(sizeof(u32) * 16, GFP_KERNEL))) {
return -ENOMEM; return -ENOMEM;
} }
memset(fbdev->info.pseudo_palette, 0, sizeof(u32) * 16);
if (fb_alloc_cmap(&fbdev->info.cmap, AU1100_LCD_NBR_PALETTE_ENTRIES, 0) < 0) { if (fb_alloc_cmap(&fbdev->info.cmap, AU1100_LCD_NBR_PALETTE_ENTRIES, 0) < 0) {
print_err("Fail to allocate colormap (%d entries)", print_err("Fail to allocate colormap (%d entries)",
......
...@@ -696,11 +696,10 @@ static int __init control_of_init(struct device_node *dp) ...@@ -696,11 +696,10 @@ static int __init control_of_init(struct device_node *dp)
printk(KERN_ERR "can't get 2 addresses for control\n"); printk(KERN_ERR "can't get 2 addresses for control\n");
return -ENXIO; return -ENXIO;
} }
p = kmalloc(sizeof(*p), GFP_KERNEL); p = kzalloc(sizeof(*p), GFP_KERNEL);
if (p == 0) if (p == 0)
return -ENXIO; return -ENXIO;
control_fb = p; /* save it for cleanups */ control_fb = p; /* save it for cleanups */
memset(p, 0, sizeof(*p));
/* Map in frame buffer and registers */ /* Map in frame buffer and registers */
p->fb_orig_base = fb_res.start; p->fb_orig_base = fb_res.start;
......
...@@ -2021,11 +2021,10 @@ static int __devinit i810fb_init_pci (struct pci_dev *dev, ...@@ -2021,11 +2021,10 @@ static int __devinit i810fb_init_pci (struct pci_dev *dev,
par = info->par; par = info->par;
par->dev = dev; par->dev = dev;
if (!(info->pixmap.addr = kmalloc(8*1024, GFP_KERNEL))) { if (!(info->pixmap.addr = kzalloc(8*1024, GFP_KERNEL))) {
i810fb_release_resource(info, par); i810fb_release_resource(info, par);
return -ENOMEM; return -ENOMEM;
} }
memset(info->pixmap.addr, 0, 8*1024);
info->pixmap.size = 8*1024; info->pixmap.size = 8*1024;
info->pixmap.buf_align = 8; info->pixmap.buf_align = 8;
info->pixmap.access_align = 32; info->pixmap.access_align = 32;
......
...@@ -401,12 +401,11 @@ int __init igafb_init(void) ...@@ -401,12 +401,11 @@ int __init igafb_init(void)
size = sizeof(struct fb_info) + sizeof(struct iga_par) + sizeof(u32)*16; size = sizeof(struct fb_info) + sizeof(struct iga_par) + sizeof(u32)*16;
info = kmalloc(size, GFP_ATOMIC); info = kzalloc(size, GFP_ATOMIC);
if (!info) { if (!info) {
printk("igafb_init: can't alloc fb_info\n"); printk("igafb_init: can't alloc fb_info\n");
return -ENOMEM; return -ENOMEM;
} }
memset(info, 0, size);
par = (struct iga_par *) (info + 1); par = (struct iga_par *) (info + 1);
...@@ -465,7 +464,7 @@ int __init igafb_init(void) ...@@ -465,7 +464,7 @@ int __init igafb_init(void)
* one additional region with size == 0. * one additional region with size == 0.
*/ */
par->mmap_map = kmalloc(4 * sizeof(*par->mmap_map), GFP_ATOMIC); par->mmap_map = kzalloc(4 * sizeof(*par->mmap_map), GFP_ATOMIC);
if (!par->mmap_map) { if (!par->mmap_map) {
printk("igafb_init: can't alloc mmap_map\n"); printk("igafb_init: can't alloc mmap_map\n");
iounmap((void *)par->io_base); iounmap((void *)par->io_base);
...@@ -474,8 +473,6 @@ int __init igafb_init(void) ...@@ -474,8 +473,6 @@ int __init igafb_init(void)
return -ENOMEM; return -ENOMEM;
} }
memset(par->mmap_map, 0, 4 * sizeof(*par->mmap_map));
/* /*
* Set default vmode and cmode from PROM properties. * Set default vmode and cmode from PROM properties.
*/ */
......
...@@ -540,12 +540,11 @@ intelfb_pci_register(struct pci_dev *pdev, const struct pci_device_id *ent) ...@@ -540,12 +540,11 @@ intelfb_pci_register(struct pci_dev *pdev, const struct pci_device_id *ent)
dinfo->pdev = pdev; dinfo->pdev = pdev;
/* Reserve pixmap space. */ /* Reserve pixmap space. */
info->pixmap.addr = kmalloc(64 * 1024, GFP_KERNEL); info->pixmap.addr = kzalloc(64 * 1024, GFP_KERNEL);
if (info->pixmap.addr == NULL) { if (info->pixmap.addr == NULL) {
ERR_MSG("Cannot reserve pixmap memory.\n"); ERR_MSG("Cannot reserve pixmap memory.\n");
goto err_out_pixmap; goto err_out_pixmap;
} }
memset(info->pixmap.addr, 0, 64 * 1024);
/* set early this option because it could be changed by tv encoder /* set early this option because it could be changed by tv encoder
driver */ driver */
......
...@@ -1205,13 +1205,11 @@ static int __devinit nvidiafb_probe(struct pci_dev *pd, ...@@ -1205,13 +1205,11 @@ static int __devinit nvidiafb_probe(struct pci_dev *pd,
par = info->par; par = info->par;
par->pci_dev = pd; par->pci_dev = pd;
info->pixmap.addr = kmalloc(8 * 1024, GFP_KERNEL); info->pixmap.addr = kzalloc(8 * 1024, GFP_KERNEL);
if (info->pixmap.addr == NULL) if (info->pixmap.addr == NULL)
goto err_out_kfree; goto err_out_kfree;
memset(info->pixmap.addr, 0, 8 * 1024);
if (pci_enable_device(pd)) { if (pci_enable_device(pd)) {
printk(KERN_ERR PFX "cannot enable PCI device\n"); printk(KERN_ERR PFX "cannot enable PCI device\n");
goto err_out_enable; goto err_out_enable;
......
...@@ -1984,12 +1984,11 @@ static int __devinit rivafb_probe(struct pci_dev *pd, ...@@ -1984,12 +1984,11 @@ static int __devinit rivafb_probe(struct pci_dev *pd,
default_par = info->par; default_par = info->par;
default_par->pdev = pd; default_par->pdev = pd;
info->pixmap.addr = kmalloc(8 * 1024, GFP_KERNEL); info->pixmap.addr = kzalloc(8 * 1024, GFP_KERNEL);
if (info->pixmap.addr == NULL) { if (info->pixmap.addr == NULL) {
ret = -ENOMEM; ret = -ENOMEM;
goto err_framebuffer_release; goto err_framebuffer_release;
} }
memset(info->pixmap.addr, 0, 8 * 1024);
ret = pci_enable_device(pd); ret = pci_enable_device(pd);
if (ret < 0) { if (ret < 0) {
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment