From: Burman Yan <[EMAIL PROTECTED]>

Replace kmalloc+memset with kzalloc

Signed-off-by: Yan Burman <[EMAIL PROTECTED]>
Signed-off-by: Greg Kroah-Hartman <[EMAIL PROTECTED]>
---
 drivers/usb/serial/ark3116.c          |    3 +--
 drivers/usb/serial/console.c          |    6 ++----
 drivers/usb/serial/garmin_gps.c       |    3 +--
 drivers/usb/serial/mos7840.c          |    3 +--
 drivers/usb/serial/ti_usb_3410_5052.c |    3 +--
 5 files changed, 6 insertions(+), 12 deletions(-)

diff --git a/drivers/usb/serial/ark3116.c b/drivers/usb/serial/ark3116.c
index ca52f12..863966c 100644
--- a/drivers/usb/serial/ark3116.c
+++ b/drivers/usb/serial/ark3116.c
@@ -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 --git a/drivers/usb/serial/console.c b/drivers/usb/serial/console.c
index 3a9073d..7167728 100644
--- a/drivers/usb/serial/console.c
+++ b/drivers/usb/serial/console.c
@@ -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 --git a/drivers/usb/serial/garmin_gps.c b/drivers/usb/serial/garmin_gps.c
index 4543152..6530d39 100644
--- a/drivers/usb/serial/garmin_gps.c
+++ b/drivers/usb/serial/garmin_gps.c
@@ -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 --git a/drivers/usb/serial/mos7840.c b/drivers/usb/serial/mos7840.c
index 5b71962..02c89e1 100644
--- a/drivers/usb/serial/mos7840.c
+++ b/drivers/usb/serial/mos7840.c
@@ -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 --git a/drivers/usb/serial/ti_usb_3410_5052.c 
b/drivers/usb/serial/ti_usb_3410_5052.c
index bbbb993..ae98d8c 100644
--- a/drivers/usb/serial/ti_usb_3410_5052.c
+++ b/drivers/usb/serial/ti_usb_3410_5052.c
@@ -461,13 +461,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;
-- 
1.4.4.1


-------------------------------------------------------------------------
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
_______________________________________________
linux-usb-devel@lists.sourceforge.net
To unsubscribe, use the last form field at:
https://lists.sourceforge.net/lists/listinfo/linux-usb-devel

Reply via email to