aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/usb/serial/visor.c
diff options
context:
space:
mode:
Diffstat (limited to 'drivers/usb/serial/visor.c')
-rw-r--r--drivers/usb/serial/visor.c22
1 files changed, 13 insertions, 9 deletions
diff --git a/drivers/usb/serial/visor.c b/drivers/usb/serial/visor.c
index 7ee087fed913..c2347995c786 100644
--- a/drivers/usb/serial/visor.c
+++ b/drivers/usb/serial/visor.c
@@ -349,16 +349,20 @@ static void visor_close (struct usb_serial_port *port, struct file * filp)
349 usb_kill_urb(port->read_urb); 349 usb_kill_urb(port->read_urb);
350 usb_kill_urb(port->interrupt_in_urb); 350 usb_kill_urb(port->interrupt_in_urb);
351 351
352 /* Try to send shutdown message, if the device is gone, this will just fail. */ 352 mutex_lock(&port->serial->disc_mutex);
353 transfer_buffer = kmalloc (0x12, GFP_KERNEL); 353 if (!port->serial->disconnected) {
354 if (transfer_buffer) { 354 /* Try to send shutdown message, unless the device is gone */
355 usb_control_msg (port->serial->dev, 355 transfer_buffer = kmalloc (0x12, GFP_KERNEL);
356 usb_rcvctrlpipe(port->serial->dev, 0), 356 if (transfer_buffer) {
357 VISOR_CLOSE_NOTIFICATION, 0xc2, 357 usb_control_msg (port->serial->dev,
358 0x0000, 0x0000, 358 usb_rcvctrlpipe(port->serial->dev, 0),
359 transfer_buffer, 0x12, 300); 359 VISOR_CLOSE_NOTIFICATION, 0xc2,
360 kfree (transfer_buffer); 360 0x0000, 0x0000,
361 transfer_buffer, 0x12, 300);
362 kfree (transfer_buffer);
363 }
361 } 364 }
365 mutex_lock(&port->serial->disc_mutex);
362 366
363 if (stats) 367 if (stats)
364 dev_info(&port->dev, "Bytes In = %d Bytes Out = %d\n", 368 dev_info(&port->dev, "Bytes In = %d Bytes Out = %d\n",