linux-fbdev.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH] matroxfb: Use kzalloc
@ 2006-12-31 16:06 Jean Delvare
  2007-02-06 20:19 ` James Simmons
  0 siblings, 1 reply; 2+ messages in thread
From: Jean Delvare @ 2006-12-31 16:06 UTC (permalink / raw)
  To: Petr Vandrovec; +Cc: linux-fbdev-devel

Use kzalloc instead of kmalloc+memset, twice.

Signed-off-by: Jean Delvare <khali@linux-fr.org>
---
 drivers/video/matrox/i2c-matroxfb.c   |    4 +---
 drivers/video/matrox/matroxfb_crtc2.c |    3 +--
 2 files changed, 2 insertions(+), 5 deletions(-)

--- linux-2.6.20-rc2.orig/drivers/video/matrox/i2c-matroxfb.c	2006-12-31 17:01:35.000000000 +0100
+++ linux-2.6.20-rc2/drivers/video/matrox/i2c-matroxfb.c	2006-12-31 17:03:01.000000000 +0100
@@ -146,7 +146,7 @@ static void* i2c_matroxfb_probe(struct m
 	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 m
 	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:
--- linux-2.6.20-rc2.orig/drivers/video/matrox/matroxfb_crtc2.c	2006-12-31 17:01:34.000000000 +0100
+++ linux-2.6.20-rc2/drivers/video/matrox/matroxfb_crtc2.c	2006-12-31 17:03:01.000000000 +0100
@@ -694,12 +694,11 @@ static void* matroxfb_crtc2_probe(struct
 	/* 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);


-- 
Jean Delvare

-------------------------------------------------------------------------
Take Surveys. Earn Cash. Influence the Future of IT
Join SourceForge.net's Techsay panel and you'll get the chance to share your
opinions on IT & business topics through brief surveys - and earn cash
http://www.techsay.com/default.php?page=join.php&p=sourceforge&CID=DEVDEV

^ permalink raw reply	[flat|nested] 2+ messages in thread

* Re: [PATCH] matroxfb: Use kzalloc
  2006-12-31 16:06 [PATCH] matroxfb: Use kzalloc Jean Delvare
@ 2007-02-06 20:19 ` James Simmons
  0 siblings, 0 replies; 2+ messages in thread
From: James Simmons @ 2007-02-06 20:19 UTC (permalink / raw)
  To: linux-fbdev-devel; +Cc: Andrew Morton, Petr Vandrovec


Acked-By: James Simmons <jsimmons@infradead.org>

On Sun, 31 Dec 2006, Jean Delvare wrote:

> Use kzalloc instead of kmalloc+memset, twice.
> 
> Signed-off-by: Jean Delvare <khali@linux-fr.org>
> ---
>  drivers/video/matrox/i2c-matroxfb.c   |    4 +---
>  drivers/video/matrox/matroxfb_crtc2.c |    3 +--
>  2 files changed, 2 insertions(+), 5 deletions(-)
> 
> --- linux-2.6.20-rc2.orig/drivers/video/matrox/i2c-matroxfb.c	2006-12-31 17:01:35.000000000 +0100
> +++ linux-2.6.20-rc2/drivers/video/matrox/i2c-matroxfb.c	2006-12-31 17:03:01.000000000 +0100
> @@ -146,7 +146,7 @@ static void* i2c_matroxfb_probe(struct m
>  	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 m
>  	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:
> --- linux-2.6.20-rc2.orig/drivers/video/matrox/matroxfb_crtc2.c	2006-12-31 17:01:34.000000000 +0100
> +++ linux-2.6.20-rc2/drivers/video/matrox/matroxfb_crtc2.c	2006-12-31 17:03:01.000000000 +0100
> @@ -694,12 +694,11 @@ static void* matroxfb_crtc2_probe(struct
>  	/* 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);
> 
> 
> 

-------------------------------------------------------------------------
Using Tomcat but need to do more? Need to support web services, security?
Get stuff done quickly with pre-integrated technology to make your job easier.
Download IBM WebSphere Application Server v.1.0.1 based on Apache Geronimo
http://sel.as-us.falkag.net/sel?cmd=lnk&kid=120709&bid=263057&dat=121642

^ permalink raw reply	[flat|nested] 2+ messages in thread

end of thread, other threads:[~2007-02-06 20:19 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2006-12-31 16:06 [PATCH] matroxfb: Use kzalloc Jean Delvare
2007-02-06 20:19 ` James Simmons

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).