diff options
Diffstat (limited to 'drivers')
| -rw-r--r-- | drivers/usb/class/cdc-acm.c | 16 |
1 files changed, 11 insertions, 5 deletions
diff --git a/drivers/usb/class/cdc-acm.c b/drivers/usb/class/cdc-acm.c index b72fa49eb257..e4eca7810bcf 100644 --- a/drivers/usb/class/cdc-acm.c +++ b/drivers/usb/class/cdc-acm.c | |||
| @@ -686,15 +686,21 @@ static void acm_tty_close(struct tty_struct *tty, struct file *filp) | |||
| 686 | 686 | ||
| 687 | /* Perform the closing process and see if we need to do the hardware | 687 | /* Perform the closing process and see if we need to do the hardware |
| 688 | shutdown */ | 688 | shutdown */ |
| 689 | if (!acm || tty_port_close_start(&acm->port, tty, filp) == 0) | 689 | if (!acm) |
| 690 | return; | ||
| 691 | if (tty_port_close_start(&acm->port, tty, filp) == 0) { | ||
| 692 | mutex_lock(&open_mutex); | ||
| 693 | if (!acm->dev) { | ||
| 694 | tty_port_tty_set(&acm->port, NULL); | ||
| 695 | acm_tty_unregister(acm); | ||
| 696 | tty->driver_data = NULL; | ||
| 697 | } | ||
| 698 | mutex_unlock(&open_mutex); | ||
| 690 | return; | 699 | return; |
| 700 | } | ||
| 691 | acm_port_down(acm, 0); | 701 | acm_port_down(acm, 0); |
| 692 | tty_port_close_end(&acm->port, tty); | 702 | tty_port_close_end(&acm->port, tty); |
| 693 | mutex_lock(&open_mutex); | ||
| 694 | tty_port_tty_set(&acm->port, NULL); | 703 | tty_port_tty_set(&acm->port, NULL); |
| 695 | if (!acm->dev) | ||
| 696 | acm_tty_unregister(acm); | ||
| 697 | mutex_unlock(&open_mutex); | ||
| 698 | } | 704 | } |
| 699 | 705 | ||
| 700 | static int acm_tty_write(struct tty_struct *tty, | 706 | static int acm_tty_write(struct tty_struct *tty, |
