staging: gdm72xx: use kzalloc to allocate usb_tx structure
authorDevendra Naga <devendra.aaru@gmail.com>
Sat, 25 Aug 2012 21:22:35 +0000 (02:52 +0530)
committerGreg Kroah-Hartman <gregkh@linuxfoundation.org>
Tue, 4 Sep 2012 18:16:22 +0000 (11:16 -0700)
the code under alloc_tx_struct does the allocation of usb_tx structure
using kmalloc, and memsets the allocated pointer, instead we can
directly use kzalloc so that the allocated memory is set with
zeros

Signed-off-by: Devendra Naga <devendra.aaru@gmail.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
drivers/staging/gdm72xx/gdm_sdio.c
drivers/staging/gdm72xx/gdm_usb.c

index 3e43c012ef27a838447b8f11ac8c1d7e90783f22..ec64d94cd68cd362b84122296cb5fee09583f0ed 100644 (file)
@@ -62,12 +62,10 @@ static struct sdio_tx *alloc_tx_struct(struct tx_cxt *tx)
 {
        struct sdio_tx *t = NULL;
 
-       t = kmalloc(sizeof(*t), GFP_ATOMIC);
+       t = kzalloc(sizeof(*t), GFP_ATOMIC);
        if (t == NULL)
                goto out;
 
-       memset(t, 0, sizeof(*t));
-
        t->buf = kmalloc(TX_BUF_SIZE, GFP_ATOMIC);
        if (t->buf == NULL)
                goto out;
index d48d49c145eef6ade610ff51593ba3a816532cfb..c7a22fa55638f45385b08d0e801d9dfe9a4775da 100644 (file)
@@ -75,12 +75,10 @@ static struct usb_tx *alloc_tx_struct(struct tx_cxt *tx)
 {
        struct usb_tx *t = NULL;
 
-       t = kmalloc(sizeof(*t), GFP_ATOMIC);
+       t = kzalloc(sizeof(*t), GFP_ATOMIC);
        if (t == NULL)
                goto out;
 
-       memset(t, 0, sizeof(*t));
-
        t->urb = usb_alloc_urb(0, GFP_ATOMIC);
        t->buf = kmalloc(TX_BUF_SIZE, GFP_ATOMIC);
        if (t->urb == NULL || t->buf == NULL)