diff options
Diffstat (limited to 'drivers/usb/class/cdc-acm.c')
-rw-r--r-- | drivers/usb/class/cdc-acm.c | 9 |
1 files changed, 6 insertions, 3 deletions
diff --git a/drivers/usb/class/cdc-acm.c b/drivers/usb/class/cdc-acm.c index 06b3b54a0e68..7b366a6c0b49 100644 --- a/drivers/usb/class/cdc-acm.c +++ b/drivers/usb/class/cdc-acm.c | |||
@@ -174,6 +174,7 @@ static int acm_wb_alloc(struct acm *acm) | |||
174 | wb = &acm->wb[wbn]; | 174 | wb = &acm->wb[wbn]; |
175 | if (!wb->use) { | 175 | if (!wb->use) { |
176 | wb->use = 1; | 176 | wb->use = 1; |
177 | wb->len = 0; | ||
177 | return wbn; | 178 | return wbn; |
178 | } | 179 | } |
179 | wbn = (wbn + 1) % ACM_NW; | 180 | wbn = (wbn + 1) % ACM_NW; |
@@ -805,16 +806,18 @@ static int acm_tty_write(struct tty_struct *tty, | |||
805 | static void acm_tty_flush_chars(struct tty_struct *tty) | 806 | static void acm_tty_flush_chars(struct tty_struct *tty) |
806 | { | 807 | { |
807 | struct acm *acm = tty->driver_data; | 808 | struct acm *acm = tty->driver_data; |
808 | struct acm_wb *cur = acm->putbuffer; | 809 | struct acm_wb *cur; |
809 | int err; | 810 | int err; |
810 | unsigned long flags; | 811 | unsigned long flags; |
811 | 812 | ||
813 | spin_lock_irqsave(&acm->write_lock, flags); | ||
814 | |||
815 | cur = acm->putbuffer; | ||
812 | if (!cur) /* nothing to do */ | 816 | if (!cur) /* nothing to do */ |
813 | return; | 817 | goto out; |
814 | 818 | ||
815 | acm->putbuffer = NULL; | 819 | acm->putbuffer = NULL; |
816 | err = usb_autopm_get_interface_async(acm->control); | 820 | err = usb_autopm_get_interface_async(acm->control); |
817 | spin_lock_irqsave(&acm->write_lock, flags); | ||
818 | if (err < 0) { | 821 | if (err < 0) { |
819 | cur->use = 0; | 822 | cur->use = 0; |
820 | acm->putbuffer = cur; | 823 | acm->putbuffer = cur; |