Commit 1f558647 authored by Teodora Baluta's avatar Teodora Baluta Committed by Greg Kroah-Hartman

staging: gdm724x: kzalloc should be used instead of kmalloc/memset

This patch fixes the following coccinelle warnings in driver gdm724x:

drivers/staging/gdm724x/gdm_usb.c:127:9-16: WARNING: kzalloc should be used for t_sdu, instead of kmalloc/memset
drivers/staging/gdm724x/gdm_usb.c:91:5-12: WARNING: kzalloc should be used for t, instead of kmalloc/memset
Signed-off-by: default avatarTeodora Baluta <teobaluta@gmail.com>
Reviewed-by: default avatarPeter P Waskiewicz Jr <peter.p.waskiewicz.jr@intel.com>
Signed-off-by: default avatarGreg Kroah-Hartman <gregkh@linuxfoundation.org>
parent 1f933fa8
...@@ -88,12 +88,11 @@ static struct usb_tx *alloc_tx_struct(int len) ...@@ -88,12 +88,11 @@ static struct usb_tx *alloc_tx_struct(int len)
struct usb_tx *t = NULL; struct usb_tx *t = NULL;
int ret = 0; int ret = 0;
t = kmalloc(sizeof(struct usb_tx), GFP_ATOMIC); t = kzalloc(sizeof(struct usb_tx), GFP_ATOMIC);
if (!t) { if (!t) {
ret = -ENOMEM; ret = -ENOMEM;
goto out; goto out;
} }
memset(t, 0, sizeof(struct usb_tx));
t->urb = usb_alloc_urb(0, GFP_ATOMIC); t->urb = usb_alloc_urb(0, GFP_ATOMIC);
if (!(len % 512)) if (!(len % 512))
...@@ -124,12 +123,11 @@ static struct usb_tx_sdu *alloc_tx_sdu_struct(void) ...@@ -124,12 +123,11 @@ static struct usb_tx_sdu *alloc_tx_sdu_struct(void)
int ret = 0; int ret = 0;
t_sdu = kmalloc(sizeof(struct usb_tx_sdu), GFP_ATOMIC); t_sdu = kzalloc(sizeof(struct usb_tx_sdu), GFP_ATOMIC);
if (!t_sdu) { if (!t_sdu) {
ret = -ENOMEM; ret = -ENOMEM;
goto out; goto out;
} }
memset(t_sdu, 0, sizeof(struct usb_tx_sdu));
t_sdu->buf = kmalloc(SDU_BUF_SIZE, GFP_ATOMIC); t_sdu->buf = kmalloc(SDU_BUF_SIZE, GFP_ATOMIC);
if (!t_sdu->buf) { if (!t_sdu->buf) {
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment