diff options
Diffstat (limited to 'drivers/usb/serial/usb-serial.c')
-rw-r--r-- | drivers/usb/serial/usb-serial.c | 6 |
1 files changed, 2 insertions, 4 deletions
diff --git a/drivers/usb/serial/usb-serial.c b/drivers/usb/serial/usb-serial.c index b5c96e74a903..097f4e8488fe 100644 --- a/drivers/usb/serial/usb-serial.c +++ b/drivers/usb/serial/usb-serial.c | |||
@@ -564,12 +564,11 @@ static struct usb_serial * create_serial (struct usb_device *dev, | |||
564 | { | 564 | { |
565 | struct usb_serial *serial; | 565 | struct usb_serial *serial; |
566 | 566 | ||
567 | serial = kmalloc (sizeof (*serial), GFP_KERNEL); | 567 | serial = kzalloc(sizeof(*serial), GFP_KERNEL); |
568 | if (!serial) { | 568 | if (!serial) { |
569 | dev_err(&dev->dev, "%s - out of memory\n", __FUNCTION__); | 569 | dev_err(&dev->dev, "%s - out of memory\n", __FUNCTION__); |
570 | return NULL; | 570 | return NULL; |
571 | } | 571 | } |
572 | memset (serial, 0, sizeof(*serial)); | ||
573 | serial->dev = usb_get_dev(dev); | 572 | serial->dev = usb_get_dev(dev); |
574 | serial->type = driver; | 573 | serial->type = driver; |
575 | serial->interface = interface; | 574 | serial->interface = interface; |
@@ -778,10 +777,9 @@ int usb_serial_probe(struct usb_interface *interface, | |||
778 | serial->num_port_pointers = max_endpoints; | 777 | serial->num_port_pointers = max_endpoints; |
779 | dbg("%s - setting up %d port structures for this device", __FUNCTION__, max_endpoints); | 778 | dbg("%s - setting up %d port structures for this device", __FUNCTION__, max_endpoints); |
780 | for (i = 0; i < max_endpoints; ++i) { | 779 | for (i = 0; i < max_endpoints; ++i) { |
781 | port = kmalloc(sizeof(struct usb_serial_port), GFP_KERNEL); | 780 | port = kzalloc(sizeof(struct usb_serial_port), GFP_KERNEL); |
782 | if (!port) | 781 | if (!port) |
783 | goto probe_error; | 782 | goto probe_error; |
784 | memset(port, 0x00, sizeof(struct usb_serial_port)); | ||
785 | port->number = i + serial->minor; | 783 | port->number = i + serial->minor; |
786 | port->serial = serial; | 784 | port->serial = serial; |
787 | spin_lock_init(&port->lock); | 785 | spin_lock_init(&port->lock); |