aboutsummaryrefslogtreecommitdiffstats
path: root/drivers
diff options
context:
space:
mode:
Diffstat (limited to 'drivers')
-rw-r--r--drivers/usb/core/config.c12
-rw-r--r--drivers/usb/core/devio.c4
-rw-r--r--drivers/usb/core/hcd.c3
-rw-r--r--drivers/usb/core/hub.c4
-rw-r--r--drivers/usb/core/message.c3
-rw-r--r--drivers/usb/core/usb.c4
6 files changed, 10 insertions, 20 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)
diff --git a/drivers/usb/core/devio.c b/drivers/usb/core/devio.c
index ffb2e242b100..942cd437dc48 100644
--- a/drivers/usb/core/devio.c
+++ b/drivers/usb/core/devio.c
@@ -210,10 +210,10 @@ err:
210static struct async *alloc_async(unsigned int numisoframes) 210static struct async *alloc_async(unsigned int numisoframes)
211{ 211{
212 unsigned int assize = sizeof(struct async) + numisoframes * sizeof(struct usb_iso_packet_descriptor); 212 unsigned int assize = sizeof(struct async) + numisoframes * sizeof(struct usb_iso_packet_descriptor);
213 struct async *as = kmalloc(assize, GFP_KERNEL); 213 struct async *as = kzalloc(assize, GFP_KERNEL);
214
214 if (!as) 215 if (!as)
215 return NULL; 216 return NULL;
216 memset(as, 0, assize);
217 as->urb = usb_alloc_urb(numisoframes, GFP_KERNEL); 217 as->urb = usb_alloc_urb(numisoframes, GFP_KERNEL);
218 if (!as->urb) { 218 if (!as->urb) {
219 kfree(as); 219 kfree(as);
diff --git a/drivers/usb/core/hcd.c b/drivers/usb/core/hcd.c
index e8f2b8d8f14d..61ef9943757e 100644
--- a/drivers/usb/core/hcd.c
+++ b/drivers/usb/core/hcd.c
@@ -744,10 +744,9 @@ struct usb_bus *usb_alloc_bus (struct usb_operations *op)
744{ 744{
745 struct usb_bus *bus; 745 struct usb_bus *bus;
746 746
747 bus = kmalloc (sizeof *bus, GFP_KERNEL); 747 bus = kzalloc (sizeof *bus, GFP_KERNEL);
748 if (!bus) 748 if (!bus)
749 return NULL; 749 return NULL;
750 memset(bus, 0, sizeof(struct usb_bus));
751 usb_bus_init (bus); 750 usb_bus_init (bus);
752 bus->op = op; 751 bus->op = op;
753 return bus; 752 return bus;
diff --git a/drivers/usb/core/hub.c b/drivers/usb/core/hub.c
index 6a2ebd89916f..8ba5854e5387 100644
--- a/drivers/usb/core/hub.c
+++ b/drivers/usb/core/hub.c
@@ -865,14 +865,12 @@ descriptor_error:
865 /* We found a hub */ 865 /* We found a hub */
866 dev_info (&intf->dev, "USB hub found\n"); 866 dev_info (&intf->dev, "USB hub found\n");
867 867
868 hub = kmalloc(sizeof(*hub), GFP_KERNEL); 868 hub = kzalloc(sizeof(*hub), GFP_KERNEL);
869 if (!hub) { 869 if (!hub) {
870 dev_dbg (&intf->dev, "couldn't kmalloc hub struct\n"); 870 dev_dbg (&intf->dev, "couldn't kmalloc hub struct\n");
871 return -ENOMEM; 871 return -ENOMEM;
872 } 872 }
873 873
874 memset(hub, 0, sizeof(*hub));
875
876 INIT_LIST_HEAD(&hub->event_list); 874 INIT_LIST_HEAD(&hub->event_list);
877 hub->intfdev = &intf->dev; 875 hub->intfdev = &intf->dev;
878 hub->hdev = hdev; 876 hub->hdev = hdev;
diff --git a/drivers/usb/core/message.c b/drivers/usb/core/message.c
index 5ad0d5e28119..3519f317898e 100644
--- a/drivers/usb/core/message.c
+++ b/drivers/usb/core/message.c
@@ -1350,7 +1350,7 @@ int usb_set_configuration(struct usb_device *dev, int configuration)
1350 } 1350 }
1351 1351
1352 for (; n < nintf; ++n) { 1352 for (; n < nintf; ++n) {
1353 new_interfaces[n] = kmalloc( 1353 new_interfaces[n] = kzalloc(
1354 sizeof(struct usb_interface), 1354 sizeof(struct usb_interface),
1355 GFP_KERNEL); 1355 GFP_KERNEL);
1356 if (!new_interfaces[n]) { 1356 if (!new_interfaces[n]) {
@@ -1391,7 +1391,6 @@ free_interfaces:
1391 struct usb_host_interface *alt; 1391 struct usb_host_interface *alt;
1392 1392
1393 cp->interface[i] = intf = new_interfaces[i]; 1393 cp->interface[i] = intf = new_interfaces[i];
1394 memset(intf, 0, sizeof(*intf));
1395 intfc = cp->intf_cache[i]; 1394 intfc = cp->intf_cache[i];
1396 intf->altsetting = intfc->altsetting; 1395 intf->altsetting = intfc->altsetting;
1397 intf->num_altsetting = intfc->num_altsetting; 1396 intf->num_altsetting = intfc->num_altsetting;
diff --git a/drivers/usb/core/usb.c b/drivers/usb/core/usb.c
index 4eca4904938f..0eefff7bcb3c 100644
--- a/drivers/usb/core/usb.c
+++ b/drivers/usb/core/usb.c
@@ -704,12 +704,10 @@ usb_alloc_dev(struct usb_device *parent, struct usb_bus *bus, unsigned port1)
704{ 704{
705 struct usb_device *dev; 705 struct usb_device *dev;
706 706
707 dev = kmalloc(sizeof(*dev), GFP_KERNEL); 707 dev = kzalloc(sizeof(*dev), GFP_KERNEL);
708 if (!dev) 708 if (!dev)
709 return NULL; 709 return NULL;
710 710
711 memset(dev, 0, sizeof(*dev));
712
713 bus = usb_bus_get(bus); 711 bus = usb_bus_get(bus);
714 if (!bus) { 712 if (!bus) {
715 kfree(dev); 713 kfree(dev);