diff options
author | Alan Stern <stern@rowland.harvard.edu> | 2005-10-24 15:38:24 -0400 |
---|---|---|
committer | Greg Kroah-Hartman <gregkh@suse.de> | 2005-10-28 19:47:51 -0400 |
commit | 0a1ef3b5a765a6f20e7b8caf295aad3276243966 (patch) | |
tree | 31d2bc231306e3ed6ed81512e460e32d00bfc730 /drivers/usb/core/config.c | |
parent | b724ae77969fd832be71419dca74bece9af287ff (diff) |
[PATCH] usbcore: Use kzalloc instead of kmalloc/memset
This patch (as590) fixes up all the remaining places where usbcore can
use kzalloc rather than kmalloc/memset.
Signed-off-by: Alan Stern <stern@rowland.harvard.edu>
Signed-off-by: Greg Kroah-Hartman <gregkh@suse.de>
Diffstat (limited to 'drivers/usb/core/config.c')
-rw-r--r-- | drivers/usb/core/config.c | 12 |
1 files changed, 4 insertions, 8 deletions
diff --git a/drivers/usb/core/config.c b/drivers/usb/core/config.c index 99595e07b653..63f374e62db2 100644 --- a/drivers/usb/core/config.c +++ b/drivers/usb/core/config.c | |||
@@ -188,10 +188,9 @@ static int usb_parse_interface(struct device *ddev, int cfgno, | |||
188 | } | 188 | } |
189 | 189 | ||
190 | len = sizeof(struct usb_host_endpoint) * num_ep; | 190 | len = sizeof(struct usb_host_endpoint) * num_ep; |
191 | alt->endpoint = kmalloc(len, GFP_KERNEL); | 191 | alt->endpoint = kzalloc(len, GFP_KERNEL); |
192 | if (!alt->endpoint) | 192 | if (!alt->endpoint) |
193 | return -ENOMEM; | 193 | return -ENOMEM; |
194 | memset(alt->endpoint, 0, len); | ||
195 | 194 | ||
196 | /* Parse all the endpoint descriptors */ | 195 | /* Parse all the endpoint descriptors */ |
197 | n = 0; | 196 | n = 0; |
@@ -353,10 +352,9 @@ static int usb_parse_configuration(struct device *ddev, int cfgidx, | |||
353 | } | 352 | } |
354 | 353 | ||
355 | len = sizeof(*intfc) + sizeof(struct usb_host_interface) * j; | 354 | len = sizeof(*intfc) + sizeof(struct usb_host_interface) * j; |
356 | config->intf_cache[i] = intfc = kmalloc(len, GFP_KERNEL); | 355 | config->intf_cache[i] = intfc = kzalloc(len, GFP_KERNEL); |
357 | if (!intfc) | 356 | if (!intfc) |
358 | return -ENOMEM; | 357 | return -ENOMEM; |
359 | memset(intfc, 0, len); | ||
360 | kref_init(&intfc->ref); | 358 | kref_init(&intfc->ref); |
361 | } | 359 | } |
362 | 360 | ||
@@ -459,16 +457,14 @@ int usb_get_configuration(struct usb_device *dev) | |||
459 | } | 457 | } |
460 | 458 | ||
461 | length = ncfg * sizeof(struct usb_host_config); | 459 | length = ncfg * sizeof(struct usb_host_config); |
462 | dev->config = kmalloc(length, GFP_KERNEL); | 460 | dev->config = kzalloc(length, GFP_KERNEL); |
463 | if (!dev->config) | 461 | if (!dev->config) |
464 | goto err2; | 462 | goto err2; |
465 | memset(dev->config, 0, length); | ||
466 | 463 | ||
467 | length = ncfg * sizeof(char *); | 464 | length = ncfg * sizeof(char *); |
468 | dev->rawdescriptors = kmalloc(length, GFP_KERNEL); | 465 | dev->rawdescriptors = kzalloc(length, GFP_KERNEL); |
469 | if (!dev->rawdescriptors) | 466 | if (!dev->rawdescriptors) |
470 | goto err2; | 467 | goto err2; |
471 | memset(dev->rawdescriptors, 0, length); | ||
472 | 468 | ||
473 | buffer = kmalloc(USB_DT_CONFIG_SIZE, GFP_KERNEL); | 469 | buffer = kmalloc(USB_DT_CONFIG_SIZE, GFP_KERNEL); |
474 | if (!buffer) | 470 | if (!buffer) |