[PATCH] USBATM: kzalloc conversion

Convert kmalloc + memset to kzalloc.

Signed-off-by: Duncan Sands <[EMAIL PROTECTED]>
Signed-off-by: Greg Kroah-Hartman <[EMAIL PROTECTED]>

---
commit 9a734efec36c991a74610c6c81d28d4222e1c02b
tree 22af3801a3dc494085cd9e3218876320121a9986
parent 0dfcd3e4444e88285ee7c199d0cbda21551d8c5d
author Duncan Sands <[EMAIL PROTECTED]> Fri, 13 Jan 2006 09:38:22 +0100
committer Greg Kroah-Hartman <[EMAIL PROTECTED]> Tue, 31 Jan 2006 17:23:39 -0800

 drivers/usb/atm/cxacru.c   |    4 +---
 drivers/usb/atm/speedtch.c |    4 +---
 drivers/usb/atm/usbatm.c   |    8 +++-----
 3 files changed, 5 insertions(+), 11 deletions(-)

diff --git a/drivers/usb/atm/cxacru.c b/drivers/usb/atm/cxacru.c
index 0b02a6d..675fdbd 100644
--- a/drivers/usb/atm/cxacru.c
+++ b/drivers/usb/atm/cxacru.c
@@ -673,14 +673,12 @@ static int cxacru_bind(struct usbatm_dat
        int ret;
 
        /* instance init */
-       instance = kmalloc(sizeof(*instance), GFP_KERNEL);
+       instance = kzalloc(sizeof(*instance), GFP_KERNEL);
        if (!instance) {
                dbg("cxacru_bind: no memory for instance data");
                return -ENOMEM;
        }
 
-       memset(instance, 0, sizeof(*instance));
-
        instance->usbatm = usbatm_instance;
        instance->modem_type = (struct cxacru_modem_type *) id->driver_info;
 
diff --git a/drivers/usb/atm/speedtch.c b/drivers/usb/atm/speedtch.c
index 1aca0b0..43ec758 100644
--- a/drivers/usb/atm/speedtch.c
+++ b/drivers/usb/atm/speedtch.c
@@ -715,7 +715,7 @@ static int speedtch_bind(struct usbatm_d
                }
        }
 
-       instance = kmalloc(sizeof(*instance), GFP_KERNEL);
+       instance = kzalloc(sizeof(*instance), GFP_KERNEL);
 
        if (!instance) {
                usb_err(usbatm, "%s: no memory for instance data!\n", __func__);
@@ -723,8 +723,6 @@ static int speedtch_bind(struct usbatm_d
                goto fail_release;
        }
 
-       memset(instance, 0, sizeof(struct speedtch_instance_data));
-
        instance->usbatm = usbatm;
 
        INIT_WORK(&instance->status_checker, (void *)speedtch_check_status, 
instance);
diff --git a/drivers/usb/atm/usbatm.c b/drivers/usb/atm/usbatm.c
index 2eb8552..3ed5f02 100644
--- a/drivers/usb/atm/usbatm.c
+++ b/drivers/usb/atm/usbatm.c
@@ -763,13 +763,12 @@ static int usbatm_atm_open(struct atm_vc
                goto fail;
        }
 
-       if (!(new = kmalloc(sizeof(struct usbatm_vcc_data), GFP_KERNEL))) {
+       if (!(new = kzalloc(sizeof(struct usbatm_vcc_data), GFP_KERNEL))) {
                atm_err(instance, "%s: no memory for vcc_data!\n", __func__);
                ret = -ENOMEM;
                goto fail;
        }
 
-       memset(new, 0, sizeof(struct usbatm_vcc_data));
        new->vcc = vcc;
        new->vpi = vpi;
        new->vci = vci;
@@ -1066,13 +1065,12 @@ int usbatm_usb_probe(struct usb_interfac
 
                instance->urbs[i] = urb;
 
-               buffer = kmalloc(channel->buf_size, GFP_KERNEL);
+               /* zero the tx padding to avoid leaking information */
+               buffer = kzalloc(channel->buf_size, GFP_KERNEL);
                if (!buffer) {
                        dev_err(dev, "%s: no memory for buffer %d!\n", 
__func__, i);
                        goto fail_unbind;
                }
-               /* zero the tx padding to avoid leaking information */
-               memset(buffer, 0, channel->buf_size);
 
                usb_fill_bulk_urb(urb, instance->usb_dev, channel->endpoint,
                                  buffer, channel->buf_size, usbatm_complete, 
channel);



-------------------------------------------------------
This SF.net email is sponsored by: Splunk Inc. Do you grep through log files
for problems?  Stop!  Download the new AJAX search engine that makes
searching your log files as easy as surfing the  web.  DOWNLOAD SPLUNK!
http://sel.as-us.falkag.net/sel?cmd=lnk&kid3432&bid#0486&dat1642
_______________________________________________
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