diff options
author | Eric Sesterhenn <snakebyte@gmx.de> | 2006-02-27 16:34:10 -0500 |
---|---|---|
committer | Greg Kroah-Hartman <gregkh@suse.de> | 2006-03-20 17:49:59 -0500 |
commit | 7039f4224d4e40b06308d5c1a97427af1a142459 (patch) | |
tree | 4529171195b1008e8615bb4b39a129ddda463b16 /drivers/usb/gadget/inode.c | |
parent | 80b6ca48321974a6566a1c9048ba34f60420bca6 (diff) |
[PATCH] USB: kzalloc() conversion in drivers/usb/gadget
this patch converts drivers/usb to kzalloc usage.
Compile tested with allyes config.
I think there was a bug in drivers/usb/gadget/inode.c because
it used sizeof(*data) for the kmalloc() and sizeof(data) for
the memset(), since sizeof(data) just returns the size for a pointer.
Signed-off-by: Eric Sesterhenn <snakebyte@gmx.de>
Signed-off-by: David Brownell <dbrownell@users.sourceforge.net>
Signed-off-by: Greg Kroah-Hartman <gregkh@suse.de>
Diffstat (limited to 'drivers/usb/gadget/inode.c')
-rw-r--r-- | drivers/usb/gadget/inode.c | 6 |
1 files changed, 2 insertions, 4 deletions
diff --git a/drivers/usb/gadget/inode.c b/drivers/usb/gadget/inode.c index 0aab7d24c768..b44cfda76b61 100644 --- a/drivers/usb/gadget/inode.c +++ b/drivers/usb/gadget/inode.c | |||
@@ -170,10 +170,9 @@ static struct dev_data *dev_new (void) | |||
170 | { | 170 | { |
171 | struct dev_data *dev; | 171 | struct dev_data *dev; |
172 | 172 | ||
173 | dev = kmalloc (sizeof *dev, GFP_KERNEL); | 173 | dev = kzalloc(sizeof(*dev), GFP_KERNEL); |
174 | if (!dev) | 174 | if (!dev) |
175 | return NULL; | 175 | return NULL; |
176 | memset (dev, 0, sizeof *dev); | ||
177 | dev->state = STATE_DEV_DISABLED; | 176 | dev->state = STATE_DEV_DISABLED; |
178 | atomic_set (&dev->count, 1); | 177 | atomic_set (&dev->count, 1); |
179 | spin_lock_init (&dev->lock); | 178 | spin_lock_init (&dev->lock); |
@@ -1592,10 +1591,9 @@ static int activate_ep_files (struct dev_data *dev) | |||
1592 | gadget_for_each_ep (ep, dev->gadget) { | 1591 | gadget_for_each_ep (ep, dev->gadget) { |
1593 | struct ep_data *data; | 1592 | struct ep_data *data; |
1594 | 1593 | ||
1595 | data = kmalloc (sizeof *data, GFP_KERNEL); | 1594 | data = kzalloc(sizeof(*data), GFP_KERNEL); |
1596 | if (!data) | 1595 | if (!data) |
1597 | goto enomem; | 1596 | goto enomem; |
1598 | memset (data, 0, sizeof data); | ||
1599 | data->state = STATE_EP_DISABLED; | 1597 | data->state = STATE_EP_DISABLED; |
1600 | init_MUTEX (&data->lock); | 1598 | init_MUTEX (&data->lock); |
1601 | init_waitqueue_head (&data->wait); | 1599 | init_waitqueue_head (&data->wait); |