mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
* [PATCH 2.6.19-rc5] USB serial: replace kmalloc+memset with kzalloc
@ 2006-11-22 18:54 Burman Yan
  0 siblings, 0 replies; 2+ messages in thread
From: Burman Yan @ 2006-11-22 18:54 UTC (permalink / raw)
  To: linux-kernel; +Cc: trivial, gregkh

[-- Attachment #1: Type: text/plain, Size: 322 bytes --]

Hi.

This patch replaces kmalloc+memset with kzalloc

Sorry for the previous post (forgot to attach the actual patch)

Regards
Yan Burman

_________________________________________________________________
Don't just search. Find. Check out the new MSN Search! 
http://search.msn.click-url.com/go/onm00200636ave/direct/01/

[-- Attachment #2: kzalloc_usb_serial.patch --]
[-- Type: application/octet-stream, Size: 4506 bytes --]

Replace kmalloc+memset with kzalloc

Signed-off-by: Yan Burman <yan_952@hotmail.com>

diff -rubp linux-2.6.19-rc5_orig/drivers/usb/serial/ark3116.c linux-2.6.19-rc5_kzalloc/drivers/usb/serial/ark3116.c
--- linux-2.6.19-rc5_orig/drivers/usb/serial/ark3116.c	2006-11-09 12:16:21.000000000 +0200
+++ linux-2.6.19-rc5_kzalloc/drivers/usb/serial/ark3116.c	2006-11-11 22:44:04.000000000 +0200
@@ -85,10 +85,9 @@ static int ark3116_attach(struct usb_ser
 	int i;
 
 	for (i = 0; i < serial->num_ports; ++i) {
-		priv = kmalloc(sizeof (struct ark3116_private), GFP_KERNEL);
+		priv = kzalloc(sizeof (struct ark3116_private), GFP_KERNEL);
 		if (!priv)
 			goto cleanup;
-		memset(priv, 0x00, sizeof (struct ark3116_private));
 		spin_lock_init(&priv->lock);
 
 		usb_set_serial_port_data(serial->port[i], priv);
diff -rubp linux-2.6.19-rc5_orig/drivers/usb/serial/console.c linux-2.6.19-rc5_kzalloc/drivers/usb/serial/console.c
--- linux-2.6.19-rc5_orig/drivers/usb/serial/console.c	2006-11-09 12:16:21.000000000 +0200
+++ linux-2.6.19-rc5_kzalloc/drivers/usb/serial/console.c	2006-11-11 22:44:04.000000000 +0200
@@ -166,19 +166,17 @@ static int usb_console_setup(struct cons
 	if (serial->type->set_termios) {
 		/* build up a fake tty structure so that the open call has something
 		 * to look at to get the cflag value */
-		tty = kmalloc (sizeof (*tty), GFP_KERNEL);
+		tty = kzalloc (sizeof (*tty), GFP_KERNEL);
 		if (!tty) {
 			err ("no more memory");
 			return -ENOMEM;
 		}
-		termios = kmalloc (sizeof (*termios), GFP_KERNEL);
+		termios = kzalloc (sizeof (*termios), GFP_KERNEL);
 		if (!termios) {
 			err ("no more memory");
 			kfree (tty);
 			return -ENOMEM;
 		}
-		memset (tty, 0x00, sizeof(*tty));
-		memset (termios, 0x00, sizeof(*termios));
 		termios->c_cflag = cflag;
 		tty->termios = termios;
 		port->tty = tty;
diff -rubp linux-2.6.19-rc5_orig/drivers/usb/serial/garmin_gps.c linux-2.6.19-rc5_kzalloc/drivers/usb/serial/garmin_gps.c
--- linux-2.6.19-rc5_orig/drivers/usb/serial/garmin_gps.c	2006-11-09 12:16:21.000000000 +0200
+++ linux-2.6.19-rc5_kzalloc/drivers/usb/serial/garmin_gps.c	2006-11-11 22:44:04.000000000 +0200
@@ -1523,12 +1523,11 @@ static int garmin_attach (struct usb_ser
 
 	dbg("%s", __FUNCTION__);
 
-	garmin_data_p = kmalloc (sizeof(struct garmin_data), GFP_KERNEL);
+	garmin_data_p = kzalloc (sizeof(struct garmin_data), GFP_KERNEL);
 	if (garmin_data_p == NULL) {
 		dev_err(&port->dev, "%s - Out of memory\n", __FUNCTION__);
 		return -ENOMEM;
 	}
-	memset (garmin_data_p, 0, sizeof(struct garmin_data));
 	init_timer(&garmin_data_p->timer);
 	spin_lock_init(&garmin_data_p->lock);
 	INIT_LIST_HEAD(&garmin_data_p->pktlist);
diff -rubp linux-2.6.19-rc5_orig/drivers/usb/serial/mos7840.c linux-2.6.19-rc5_kzalloc/drivers/usb/serial/mos7840.c
--- linux-2.6.19-rc5_orig/drivers/usb/serial/mos7840.c	2006-11-09 12:16:21.000000000 +0200
+++ linux-2.6.19-rc5_kzalloc/drivers/usb/serial/mos7840.c	2006-11-11 22:44:04.000000000 +0200
@@ -2596,12 +2596,11 @@ static int mos7840_startup(struct usb_se
 
 	/* set up port private structures */
 	for (i = 0; i < serial->num_ports; ++i) {
-		mos7840_port = kmalloc(sizeof(struct moschip_port), GFP_KERNEL);
+		mos7840_port = kzalloc(sizeof(struct moschip_port), GFP_KERNEL);
 		if (mos7840_port == NULL) {
 			err("%s - Out of memory", __FUNCTION__);
 			return -ENOMEM;
 		}
-		memset(mos7840_port, 0, sizeof(struct moschip_port));
 
 		/* Initialize all port interrupt end point to port 0 int endpoint *
 		 * Our device has only one interrupt end point comman to all port */
diff -rubp linux-2.6.19-rc5_orig/drivers/usb/serial/ti_usb_3410_5052.c linux-2.6.19-rc5_kzalloc/drivers/usb/serial/ti_usb_3410_5052.c
--- linux-2.6.19-rc5_orig/drivers/usb/serial/ti_usb_3410_5052.c	2006-11-09 12:16:21.000000000 +0200
+++ linux-2.6.19-rc5_kzalloc/drivers/usb/serial/ti_usb_3410_5052.c	2006-11-11 22:44:04.000000000 +0200
@@ -459,13 +459,12 @@ static int ti_startup(struct usb_serial 
 
 	/* set up port structures */
 	for (i = 0; i < serial->num_ports; ++i) {
-		tport = kmalloc(sizeof(struct ti_port), GFP_KERNEL);
+		tport = kzalloc(sizeof(struct ti_port), GFP_KERNEL);
 		if (tport == NULL) {
 			dev_err(&dev->dev, "%s - out of memory\n", __FUNCTION__);
 			status = -ENOMEM;
 			goto free_tports;
 		}
-		memset(tport, 0, sizeof(struct ti_port));
 		spin_lock_init(&tport->tp_lock);
 		tport->tp_uart_base_addr = (i == 0 ? TI_UART1_BASE_ADDR : TI_UART2_BASE_ADDR);
 		tport->tp_flags = low_latency ? ASYNC_LOW_LATENCY : 0;

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

* [PATCH 2.6.19-rc5] USB serial: replace kmalloc+memset with kzalloc
@ 2006-11-22 18:52 Burman Yan
  0 siblings, 0 replies; 2+ messages in thread
From: Burman Yan @ 2006-11-22 18:52 UTC (permalink / raw)
  To: linux-kernel; +Cc: trivial, gregkh

Hi.

This patch replaces kmalloc+memset with kzalloc in the usb serial code

Regards
Yan Burman

_________________________________________________________________
Express yourself instantly with MSN Messenger! Download today it's FREE! 
http://messenger.msn.click-url.com/go/onm00200471ave/direct/01/


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

end of thread, other threads:[~2006-11-22 18:54 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2006-11-22 18:54 [PATCH 2.6.19-rc5] USB serial: replace kmalloc+memset with kzalloc Burman Yan
  -- strict thread matches above, loose matches on Subject: below --
2006-11-22 18:52 Burman Yan

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox

all inboxes | Powered by JetHome®