[PATCH] matroxfb: Use kzalloc
authorJean Delvare <khali@linux-fr.org>
Mon, 12 Feb 2007 08:55:07 +0000 (00:55 -0800)
committerLinus Torvalds <torvalds@woody.linux-foundation.org>
Mon, 12 Feb 2007 17:48:42 +0000 (09:48 -0800)
Use kzalloc instead of kmalloc+memset, twice.

Signed-off-by: Jean Delvare <khali@linux-fr.org>
Cc: Petr Vandrovec <vandrove@vc.cvut.cz>
Acked-By: James Simmons <jsimmons@infradead.org>
Signed-off-by: Andrew Morton <akpm@linux-foundation.org>
Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
drivers/video/matrox/i2c-matroxfb.c
drivers/video/matrox/matroxfb_crtc2.c

index fe28848e7b52e201f128d58b56f1a50c23a23526..f64c4a0984cd22857eb81f56eb9195b4f86d20bf 100644 (file)
@@ -146,7 +146,7 @@ static void* i2c_matroxfb_probe(struct matrox_fb_info* minfo) {
        unsigned long flags;
        struct matroxfb_dh_maven_info* m2info;
 
-       m2info = kmalloc(sizeof(*m2info), GFP_KERNEL);
+       m2info = kzalloc(sizeof(*m2info), GFP_KERNEL);
        if (!m2info)
                return NULL;
 
@@ -155,8 +155,6 @@ static void* i2c_matroxfb_probe(struct matrox_fb_info* minfo) {
        matroxfb_DAC_out(PMINFO DAC_XGENIOCTRL, 0x00);
        matroxfb_DAC_unlock_irqrestore(flags);
 
-       memset(m2info, 0, sizeof(*m2info));
-
        switch (ACCESS_FBINFO(chip)) {
                case MGA_2064:
                case MGA_2164:
index 2c9801090faeaa89e95b0c9d2a1ad3822052cc61..03ae55b168ff3a9b8e12a43f0e828c2816d945db 100644 (file)
@@ -694,12 +694,11 @@ static void* matroxfb_crtc2_probe(struct matrox_fb_info* minfo) {
        /* hardware is CRTC2 incapable... */
        if (!ACCESS_FBINFO(devflags.crtc2))
                return NULL;
-       m2info = kmalloc(sizeof(*m2info), GFP_KERNEL);
+       m2info = kzalloc(sizeof(*m2info), GFP_KERNEL);
        if (!m2info) {
                printk(KERN_ERR "matroxfb_crtc2: Not enough memory for CRTC2 control structs\n");
                return NULL;
        }
-       memset(m2info, 0, sizeof(*m2info));
        m2info->primary_dev = MINFO;
        if (matroxfb_dh_registerfb(m2info)) {
                kfree(m2info);