aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/usb/serial
diff options
context:
space:
mode:
authorEric Sesterhenn <snakebyte@gmx.de>2006-02-27 15:29:43 -0500
committerGreg Kroah-Hartman <gregkh@suse.de>2006-03-20 17:49:59 -0500
commit80b6ca48321974a6566a1c9048ba34f60420bca6 (patch)
treea350e3cf6b794081c13c89d5b1913b2c1207570d /drivers/usb/serial
parentd54a5cb6484705f7808b337917cc7598f2f971c3 (diff)
[PATCH] USB: kzalloc() conversion for rest of drivers/usb
Signed-off-by: Eric Sesterhenn <snakebyte@gmx.de> Signed-off-by: Greg Kroah-Hartman <gregkh@suse.de>
Diffstat (limited to 'drivers/usb/serial')
-rw-r--r--drivers/usb/serial/cp2101.c4
-rw-r--r--drivers/usb/serial/cypress_m8.c3
-rw-r--r--drivers/usb/serial/ftdi_sio.c3
-rw-r--r--drivers/usb/serial/garmin_gps.c3
-rw-r--r--drivers/usb/serial/io_edgeport.c3
-rw-r--r--drivers/usb/serial/io_ti.c6
-rw-r--r--drivers/usb/serial/ir-usb.c3
-rw-r--r--drivers/usb/serial/keyspan.c6
-rw-r--r--drivers/usb/serial/kobil_sct.c16
-rw-r--r--drivers/usb/serial/mct_u232.c3
-rw-r--r--drivers/usb/serial/option.c3
-rw-r--r--drivers/usb/serial/pl2303.c6
-rw-r--r--drivers/usb/serial/ti_usb_3410_5052.c3
-rw-r--r--drivers/usb/serial/usb-serial.c6
-rw-r--r--drivers/usb/serial/visor.c3
15 files changed, 23 insertions, 48 deletions
diff --git a/drivers/usb/serial/cp2101.c b/drivers/usb/serial/cp2101.c
index dc7a069503e0..9ea7b4a4a22b 100644
--- a/drivers/usb/serial/cp2101.c
+++ b/drivers/usb/serial/cp2101.c
@@ -169,9 +169,7 @@ static int cp2101_get_config(struct usb_serial_port* port, u8 request,
169 /* Number of integers required to contain the array */ 169 /* Number of integers required to contain the array */
170 length = (((size - 1) | 3) + 1)/4; 170 length = (((size - 1) | 3) + 1)/4;
171 171
172 buf = kmalloc (length * sizeof(u32), GFP_KERNEL); 172 buf = kcalloc(length, sizeof(u32), GFP_KERNEL);
173 memset(buf, 0, length * sizeof(u32));
174
175 if (!buf) { 173 if (!buf) {
176 dev_err(&port->dev, "%s - out of memory.\n", __FUNCTION__); 174 dev_err(&port->dev, "%s - out of memory.\n", __FUNCTION__);
177 return -ENOMEM; 175 return -ENOMEM;
diff --git a/drivers/usb/serial/cypress_m8.c b/drivers/usb/serial/cypress_m8.c
index 68067fe117a4..71af3bf5adb7 100644
--- a/drivers/usb/serial/cypress_m8.c
+++ b/drivers/usb/serial/cypress_m8.c
@@ -435,11 +435,10 @@ static int generic_startup (struct usb_serial *serial)
435 435
436 dbg("%s - port %d", __FUNCTION__, serial->port[0]->number); 436 dbg("%s - port %d", __FUNCTION__, serial->port[0]->number);
437 437
438 priv = kmalloc(sizeof (struct cypress_private), GFP_KERNEL); 438 priv = kzalloc(sizeof (struct cypress_private), GFP_KERNEL);
439 if (!priv) 439 if (!priv)
440 return -ENOMEM; 440 return -ENOMEM;
441 441
442 memset(priv, 0x00, sizeof (struct cypress_private));
443 spin_lock_init(&priv->lock); 442 spin_lock_init(&priv->lock);
444 priv->buf = cypress_buf_alloc(CYPRESS_BUF_SIZE); 443 priv->buf = cypress_buf_alloc(CYPRESS_BUF_SIZE);
445 if (priv->buf == NULL) { 444 if (priv->buf == NULL) {
diff --git a/drivers/usb/serial/ftdi_sio.c b/drivers/usb/serial/ftdi_sio.c
index c145e1ed8429..ece52a6328b5 100644
--- a/drivers/usb/serial/ftdi_sio.c
+++ b/drivers/usb/serial/ftdi_sio.c
@@ -1141,12 +1141,11 @@ static int ftdi_sio_attach (struct usb_serial *serial)
1141 1141
1142 dbg("%s",__FUNCTION__); 1142 dbg("%s",__FUNCTION__);
1143 1143
1144 priv = kmalloc(sizeof(struct ftdi_private), GFP_KERNEL); 1144 priv = kzalloc(sizeof(struct ftdi_private), GFP_KERNEL);
1145 if (!priv){ 1145 if (!priv){
1146 err("%s- kmalloc(%Zd) failed.", __FUNCTION__, sizeof(struct ftdi_private)); 1146 err("%s- kmalloc(%Zd) failed.", __FUNCTION__, sizeof(struct ftdi_private));
1147 return -ENOMEM; 1147 return -ENOMEM;
1148 } 1148 }
1149 memset(priv, 0, sizeof(*priv));
1150 1149
1151 spin_lock_init(&priv->rx_lock); 1150 spin_lock_init(&priv->rx_lock);
1152 init_waitqueue_head(&priv->delta_msr_wait); 1151 init_waitqueue_head(&priv->delta_msr_wait);
diff --git a/drivers/usb/serial/garmin_gps.c b/drivers/usb/serial/garmin_gps.c
index d6f55e9dccae..5ec9bf5bac8d 100644
--- a/drivers/usb/serial/garmin_gps.c
+++ b/drivers/usb/serial/garmin_gps.c
@@ -1422,12 +1422,11 @@ static int garmin_attach (struct usb_serial *serial)
1422 1422
1423 dbg("%s", __FUNCTION__); 1423 dbg("%s", __FUNCTION__);
1424 1424
1425 garmin_data_p = kmalloc (sizeof(struct garmin_data), GFP_KERNEL); 1425 garmin_data_p = kzalloc(sizeof(struct garmin_data), GFP_KERNEL);
1426 if (garmin_data_p == NULL) { 1426 if (garmin_data_p == NULL) {
1427 dev_err(&port->dev, "%s - Out of memory\n", __FUNCTION__); 1427 dev_err(&port->dev, "%s - Out of memory\n", __FUNCTION__);
1428 return -ENOMEM; 1428 return -ENOMEM;
1429 } 1429 }
1430 memset (garmin_data_p, 0, sizeof(struct garmin_data));
1431 init_timer(&garmin_data_p->timer); 1430 init_timer(&garmin_data_p->timer);
1432 spin_lock_init(&garmin_data_p->lock); 1431 spin_lock_init(&garmin_data_p->lock);
1433 INIT_LIST_HEAD(&garmin_data_p->pktlist); 1432 INIT_LIST_HEAD(&garmin_data_p->pktlist);
diff --git a/drivers/usb/serial/io_edgeport.c b/drivers/usb/serial/io_edgeport.c
index 3f29e6b0fd19..b606c5968102 100644
--- a/drivers/usb/serial/io_edgeport.c
+++ b/drivers/usb/serial/io_edgeport.c
@@ -2725,12 +2725,11 @@ static int edge_startup (struct usb_serial *serial)
2725 dev = serial->dev; 2725 dev = serial->dev;
2726 2726
2727 /* create our private serial structure */ 2727 /* create our private serial structure */
2728 edge_serial = kmalloc (sizeof(struct edgeport_serial), GFP_KERNEL); 2728 edge_serial = kzalloc(sizeof(struct edgeport_serial), GFP_KERNEL);
2729 if (edge_serial == NULL) { 2729 if (edge_serial == NULL) {
2730 dev_err(&serial->dev->dev, "%s - Out of memory\n", __FUNCTION__); 2730 dev_err(&serial->dev->dev, "%s - Out of memory\n", __FUNCTION__);
2731 return -ENOMEM; 2731 return -ENOMEM;
2732 } 2732 }
2733 memset (edge_serial, 0, sizeof(struct edgeport_serial));
2734 spin_lock_init(&edge_serial->es_lock); 2733 spin_lock_init(&edge_serial->es_lock);
2735 edge_serial->serial = serial; 2734 edge_serial->serial = serial;
2736 usb_set_serial_data(serial, edge_serial); 2735 usb_set_serial_data(serial, edge_serial);
diff --git a/drivers/usb/serial/io_ti.c b/drivers/usb/serial/io_ti.c
index afc0f34b3a46..8e1e2253748b 100644
--- a/drivers/usb/serial/io_ti.c
+++ b/drivers/usb/serial/io_ti.c
@@ -2727,12 +2727,11 @@ static int edge_startup (struct usb_serial *serial)
2727 dev = serial->dev; 2727 dev = serial->dev;
2728 2728
2729 /* create our private serial structure */ 2729 /* create our private serial structure */
2730 edge_serial = kmalloc (sizeof(struct edgeport_serial), GFP_KERNEL); 2730 edge_serial = kzalloc(sizeof(struct edgeport_serial), GFP_KERNEL);
2731 if (edge_serial == NULL) { 2731 if (edge_serial == NULL) {
2732 dev_err(&serial->dev->dev, "%s - Out of memory\n", __FUNCTION__); 2732 dev_err(&serial->dev->dev, "%s - Out of memory\n", __FUNCTION__);
2733 return -ENOMEM; 2733 return -ENOMEM;
2734 } 2734 }
2735 memset (edge_serial, 0, sizeof(struct edgeport_serial));
2736 sema_init(&edge_serial->es_sem, 1); 2735 sema_init(&edge_serial->es_sem, 1);
2737 edge_serial->serial = serial; 2736 edge_serial->serial = serial;
2738 usb_set_serial_data(serial, edge_serial); 2737 usb_set_serial_data(serial, edge_serial);
@@ -2745,12 +2744,11 @@ static int edge_startup (struct usb_serial *serial)
2745 2744
2746 /* set up our port private structures */ 2745 /* set up our port private structures */
2747 for (i = 0; i < serial->num_ports; ++i) { 2746 for (i = 0; i < serial->num_ports; ++i) {
2748 edge_port = kmalloc (sizeof(struct edgeport_port), GFP_KERNEL); 2747 edge_port = kzalloc(sizeof(struct edgeport_port), GFP_KERNEL);
2749 if (edge_port == NULL) { 2748 if (edge_port == NULL) {
2750 dev_err(&serial->dev->dev, "%s - Out of memory\n", __FUNCTION__); 2749 dev_err(&serial->dev->dev, "%s - Out of memory\n", __FUNCTION__);
2751 goto cleanup; 2750 goto cleanup;
2752 } 2751 }
2753 memset (edge_port, 0, sizeof(struct edgeport_port));
2754 spin_lock_init(&edge_port->ep_lock); 2752 spin_lock_init(&edge_port->ep_lock);
2755 edge_port->ep_out_buf = edge_buf_alloc(EDGE_OUT_BUF_SIZE); 2753 edge_port->ep_out_buf = edge_buf_alloc(EDGE_OUT_BUF_SIZE);
2756 if (edge_port->ep_out_buf == NULL) { 2754 if (edge_port->ep_out_buf == NULL) {
diff --git a/drivers/usb/serial/ir-usb.c b/drivers/usb/serial/ir-usb.c
index a59010421444..426182ddc42a 100644
--- a/drivers/usb/serial/ir-usb.c
+++ b/drivers/usb/serial/ir-usb.c
@@ -184,10 +184,9 @@ static struct irda_class_desc *irda_usb_find_class_desc(struct usb_device *dev,
184 struct irda_class_desc *desc; 184 struct irda_class_desc *desc;
185 int ret; 185 int ret;
186 186
187 desc = kmalloc(sizeof (struct irda_class_desc), GFP_KERNEL); 187 desc = kzalloc(sizeof (struct irda_class_desc), GFP_KERNEL);
188 if (desc == NULL) 188 if (desc == NULL)
189 return NULL; 189 return NULL;
190 memset(desc, 0, sizeof(struct irda_class_desc));
191 190
192 ret = usb_control_msg(dev, usb_rcvctrlpipe(dev,0), 191 ret = usb_control_msg(dev, usb_rcvctrlpipe(dev,0),
193 IU_REQ_GET_CLASS_DESC, 192 IU_REQ_GET_CLASS_DESC,
diff --git a/drivers/usb/serial/keyspan.c b/drivers/usb/serial/keyspan.c
index 3b958e60f5e8..052b735c4fbd 100644
--- a/drivers/usb/serial/keyspan.c
+++ b/drivers/usb/serial/keyspan.c
@@ -2250,12 +2250,11 @@ static int keyspan_startup (struct usb_serial *serial)
2250 } 2250 }
2251 2251
2252 /* Setup private data for serial driver */ 2252 /* Setup private data for serial driver */
2253 s_priv = kmalloc(sizeof(struct keyspan_serial_private), GFP_KERNEL); 2253 s_priv = kzalloc(sizeof(struct keyspan_serial_private), GFP_KERNEL);
2254 if (!s_priv) { 2254 if (!s_priv) {
2255 dbg("%s - kmalloc for keyspan_serial_private failed.", __FUNCTION__); 2255 dbg("%s - kmalloc for keyspan_serial_private failed.", __FUNCTION__);
2256 return -ENOMEM; 2256 return -ENOMEM;
2257 } 2257 }
2258 memset(s_priv, 0, sizeof(struct keyspan_serial_private));
2259 2258
2260 s_priv->device_details = d_details; 2259 s_priv->device_details = d_details;
2261 usb_set_serial_data(serial, s_priv); 2260 usb_set_serial_data(serial, s_priv);
@@ -2263,12 +2262,11 @@ static int keyspan_startup (struct usb_serial *serial)
2263 /* Now setup per port private data */ 2262 /* Now setup per port private data */
2264 for (i = 0; i < serial->num_ports; i++) { 2263 for (i = 0; i < serial->num_ports; i++) {
2265 port = serial->port[i]; 2264 port = serial->port[i];
2266 p_priv = kmalloc(sizeof(struct keyspan_port_private), GFP_KERNEL); 2265 p_priv = kzalloc(sizeof(struct keyspan_port_private), GFP_KERNEL);
2267 if (!p_priv) { 2266 if (!p_priv) {
2268 dbg("%s - kmalloc for keyspan_port_private (%d) failed!.", __FUNCTION__, i); 2267 dbg("%s - kmalloc for keyspan_port_private (%d) failed!.", __FUNCTION__, i);
2269 return (1); 2268 return (1);
2270 } 2269 }
2271 memset(p_priv, 0, sizeof(struct keyspan_port_private));
2272 p_priv->device_details = d_details; 2270 p_priv->device_details = d_details;
2273 usb_set_serial_port_data(port, p_priv); 2271 usb_set_serial_port_data(port, p_priv);
2274 } 2272 }
diff --git a/drivers/usb/serial/kobil_sct.c b/drivers/usb/serial/kobil_sct.c
index b8b213185d0f..87dfcd89ffab 100644
--- a/drivers/usb/serial/kobil_sct.c
+++ b/drivers/usb/serial/kobil_sct.c
@@ -255,11 +255,9 @@ static int kobil_open (struct usb_serial_port *port, struct file *filp)
255 } 255 }
256 256
257 // allocate memory for transfer buffer 257 // allocate memory for transfer buffer
258 transfer_buffer = (unsigned char *) kmalloc(transfer_buffer_length, GFP_KERNEL); 258 transfer_buffer = kzalloc(transfer_buffer_length, GFP_KERNEL);
259 if (! transfer_buffer) { 259 if (! transfer_buffer) {
260 return -ENOMEM; 260 return -ENOMEM;
261 } else {
262 memset(transfer_buffer, 0, transfer_buffer_length);
263 } 261 }
264 262
265 // allocate write_urb 263 // allocate write_urb
@@ -383,11 +381,10 @@ static void kobil_read_int_callback( struct urb *purb, struct pt_regs *regs)
383 381
384 // BEGIN DEBUG 382 // BEGIN DEBUG
385 /* 383 /*
386 dbg_data = (unsigned char *) kmalloc((3 * purb->actual_length + 10) * sizeof(char), GFP_KERNEL); 384 dbg_data = kzalloc((3 * purb->actual_length + 10) * sizeof(char), GFP_KERNEL);
387 if (! dbg_data) { 385 if (! dbg_data) {
388 return; 386 return;
389 } 387 }
390 memset(dbg_data, 0, (3 * purb->actual_length + 10));
391 for (i = 0; i < purb->actual_length; i++) { 388 for (i = 0; i < purb->actual_length; i++) {
392 sprintf(dbg_data +3*i, "%02X ", data[i]); 389 sprintf(dbg_data +3*i, "%02X ", data[i]);
393 } 390 }
@@ -518,11 +515,10 @@ static int kobil_tiocmget(struct usb_serial_port *port, struct file *file)
518 } 515 }
519 516
520 // allocate memory for transfer buffer 517 // allocate memory for transfer buffer
521 transfer_buffer = (unsigned char *) kmalloc(transfer_buffer_length, GFP_KERNEL); 518 transfer_buffer = kzalloc(transfer_buffer_length, GFP_KERNEL);
522 if (!transfer_buffer) { 519 if (!transfer_buffer) {
523 return -ENOMEM; 520 return -ENOMEM;
524 } 521 }
525 memset(transfer_buffer, 0, transfer_buffer_length);
526 522
527 result = usb_control_msg( port->serial->dev, 523 result = usb_control_msg( port->serial->dev,
528 usb_rcvctrlpipe(port->serial->dev, 0 ), 524 usb_rcvctrlpipe(port->serial->dev, 0 ),
@@ -564,11 +560,10 @@ static int kobil_tiocmset(struct usb_serial_port *port, struct file *file,
564 } 560 }
565 561
566 // allocate memory for transfer buffer 562 // allocate memory for transfer buffer
567 transfer_buffer = (unsigned char *) kmalloc(transfer_buffer_length, GFP_KERNEL); 563 transfer_buffer = kzalloc(transfer_buffer_length, GFP_KERNEL);
568 if (! transfer_buffer) { 564 if (! transfer_buffer) {
569 return -ENOMEM; 565 return -ENOMEM;
570 } 566 }
571 memset(transfer_buffer, 0, transfer_buffer_length);
572 567
573 if (set & TIOCM_RTS) 568 if (set & TIOCM_RTS)
574 rts = 1; 569 rts = 1;
@@ -655,11 +650,10 @@ static int kobil_ioctl(struct usb_serial_port *port, struct file *file,
655 (struct termios __user *)arg)) 650 (struct termios __user *)arg))
656 return -EFAULT; 651 return -EFAULT;
657 652
658 settings = (unsigned char *) kmalloc(50, GFP_KERNEL); 653 settings = kzalloc(50, GFP_KERNEL);
659 if (! settings) { 654 if (! settings) {
660 return -ENOBUFS; 655 return -ENOBUFS;
661 } 656 }
662 memset(settings, 0, 50);
663 657
664 switch (priv->internal_termios.c_cflag & CBAUD) { 658 switch (priv->internal_termios.c_cflag & CBAUD) {
665 case B1200: 659 case B1200:
diff --git a/drivers/usb/serial/mct_u232.c b/drivers/usb/serial/mct_u232.c
index b6d6cab9c859..35bd29b6c408 100644
--- a/drivers/usb/serial/mct_u232.c
+++ b/drivers/usb/serial/mct_u232.c
@@ -348,10 +348,9 @@ static int mct_u232_startup (struct usb_serial *serial)
348 struct mct_u232_private *priv; 348 struct mct_u232_private *priv;
349 struct usb_serial_port *port, *rport; 349 struct usb_serial_port *port, *rport;
350 350
351 priv = kmalloc(sizeof(struct mct_u232_private), GFP_KERNEL); 351 priv = kzalloc(sizeof(struct mct_u232_private), GFP_KERNEL);
352 if (!priv) 352 if (!priv)
353 return -ENOMEM; 353 return -ENOMEM;
354 memset(priv, 0, sizeof(struct mct_u232_private));
355 spin_lock_init(&priv->lock); 354 spin_lock_init(&priv->lock);
356 usb_set_serial_port_data(serial->port[0], priv); 355 usb_set_serial_port_data(serial->port[0], priv);
357 356
diff --git a/drivers/usb/serial/option.c b/drivers/usb/serial/option.c
index 52bdf6fe46f2..a8455c9e79dd 100644
--- a/drivers/usb/serial/option.c
+++ b/drivers/usb/serial/option.c
@@ -631,13 +631,12 @@ static int option_startup(struct usb_serial *serial)
631 /* Now setup per port private data */ 631 /* Now setup per port private data */
632 for (i = 0; i < serial->num_ports; i++) { 632 for (i = 0; i < serial->num_ports; i++) {
633 port = serial->port[i]; 633 port = serial->port[i];
634 portdata = kmalloc(sizeof(*portdata), GFP_KERNEL); 634 portdata = kzalloc(sizeof(*portdata), GFP_KERNEL);
635 if (!portdata) { 635 if (!portdata) {
636 dbg("%s: kmalloc for option_port_private (%d) failed!.", 636 dbg("%s: kmalloc for option_port_private (%d) failed!.",
637 __FUNCTION__, i); 637 __FUNCTION__, i);
638 return (1); 638 return (1);
639 } 639 }
640 memset(portdata, 0, sizeof(struct option_port_private));
641 640
642 usb_set_serial_port_data(port, portdata); 641 usb_set_serial_port_data(port, portdata);
643 642
diff --git a/drivers/usb/serial/pl2303.c b/drivers/usb/serial/pl2303.c
index 37c81c08faad..cf2213bae0e0 100644
--- a/drivers/usb/serial/pl2303.c
+++ b/drivers/usb/serial/pl2303.c
@@ -218,10 +218,9 @@ static int pl2303_startup (struct usb_serial *serial)
218 dbg("device type: %d", type); 218 dbg("device type: %d", type);
219 219
220 for (i = 0; i < serial->num_ports; ++i) { 220 for (i = 0; i < serial->num_ports; ++i) {
221 priv = kmalloc (sizeof (struct pl2303_private), GFP_KERNEL); 221 priv = kzalloc(sizeof(struct pl2303_private), GFP_KERNEL);
222 if (!priv) 222 if (!priv)
223 goto cleanup; 223 goto cleanup;
224 memset (priv, 0x00, sizeof (struct pl2303_private));
225 spin_lock_init(&priv->lock); 224 spin_lock_init(&priv->lock);
226 priv->buf = pl2303_buf_alloc(PL2303_BUF_SIZE); 225 priv->buf = pl2303_buf_alloc(PL2303_BUF_SIZE);
227 if (priv->buf == NULL) { 226 if (priv->buf == NULL) {
@@ -383,12 +382,11 @@ static void pl2303_set_termios (struct usb_serial_port *port, struct termios *ol
383 } 382 }
384 } 383 }
385 384
386 buf = kmalloc (7, GFP_KERNEL); 385 buf = kzalloc (7, GFP_KERNEL);
387 if (!buf) { 386 if (!buf) {
388 dev_err(&port->dev, "%s - out of memory.\n", __FUNCTION__); 387 dev_err(&port->dev, "%s - out of memory.\n", __FUNCTION__);
389 return; 388 return;
390 } 389 }
391 memset (buf, 0x00, 0x07);
392 390
393 i = usb_control_msg (serial->dev, usb_rcvctrlpipe (serial->dev, 0), 391 i = usb_control_msg (serial->dev, usb_rcvctrlpipe (serial->dev, 0),
394 GET_LINE_REQUEST, GET_LINE_REQUEST_TYPE, 392 GET_LINE_REQUEST, GET_LINE_REQUEST_TYPE,
diff --git a/drivers/usb/serial/ti_usb_3410_5052.c b/drivers/usb/serial/ti_usb_3410_5052.c
index c18db3257073..c3a2071b802d 100644
--- a/drivers/usb/serial/ti_usb_3410_5052.c
+++ b/drivers/usb/serial/ti_usb_3410_5052.c
@@ -416,12 +416,11 @@ static int ti_startup(struct usb_serial *serial)
416 dev->actconfig->desc.bConfigurationValue); 416 dev->actconfig->desc.bConfigurationValue);
417 417
418 /* create device structure */ 418 /* create device structure */
419 tdev = kmalloc(sizeof(struct ti_device), GFP_KERNEL); 419 tdev = kzalloc(sizeof(struct ti_device), GFP_KERNEL);
420 if (tdev == NULL) { 420 if (tdev == NULL) {
421 dev_err(&dev->dev, "%s - out of memory\n", __FUNCTION__); 421 dev_err(&dev->dev, "%s - out of memory\n", __FUNCTION__);
422 return -ENOMEM; 422 return -ENOMEM;
423 } 423 }
424 memset(tdev, 0, sizeof(struct ti_device));
425 sema_init(&tdev->td_open_close_sem, 1); 424 sema_init(&tdev->td_open_close_sem, 1);
426 tdev->td_serial = serial; 425 tdev->td_serial = serial;
427 usb_set_serial_data(serial, tdev); 426 usb_set_serial_data(serial, tdev);
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);
diff --git a/drivers/usb/serial/visor.c b/drivers/usb/serial/visor.c
index 11a48d874752..f5c3841d4843 100644
--- a/drivers/usb/serial/visor.c
+++ b/drivers/usb/serial/visor.c
@@ -763,10 +763,9 @@ static int generic_startup(struct usb_serial *serial)
763 int i; 763 int i;
764 764
765 for (i = 0; i < serial->num_ports; ++i) { 765 for (i = 0; i < serial->num_ports; ++i) {
766 priv = kmalloc (sizeof(*priv), GFP_KERNEL); 766 priv = kzalloc (sizeof(*priv), GFP_KERNEL);
767 if (!priv) 767 if (!priv)
768 return -ENOMEM; 768 return -ENOMEM;
769 memset (priv, 0x00, sizeof(*priv));
770 spin_lock_init(&priv->lock); 769 spin_lock_init(&priv->lock);
771 usb_set_serial_port_data(serial->port[i], priv); 770 usb_set_serial_port_data(serial->port[i], priv);
772 } 771 }