diff options
Diffstat (limited to 'drivers/usb/class')
| -rw-r--r-- | drivers/usb/class/cdc-wdm.c | 7 |
1 files changed, 5 insertions, 2 deletions
diff --git a/drivers/usb/class/cdc-wdm.c b/drivers/usb/class/cdc-wdm.c index cd017a914c5d..5d151653ae43 100644 --- a/drivers/usb/class/cdc-wdm.c +++ b/drivers/usb/class/cdc-wdm.c | |||
| @@ -157,8 +157,9 @@ static void wdm_out_callback(struct urb *urb) | |||
| 157 | spin_lock(&desc->iuspin); | 157 | spin_lock(&desc->iuspin); |
| 158 | desc->werr = urb->status; | 158 | desc->werr = urb->status; |
| 159 | spin_unlock(&desc->iuspin); | 159 | spin_unlock(&desc->iuspin); |
| 160 | clear_bit(WDM_IN_USE, &desc->flags); | ||
| 161 | kfree(desc->outbuf); | 160 | kfree(desc->outbuf); |
| 161 | desc->outbuf = NULL; | ||
| 162 | clear_bit(WDM_IN_USE, &desc->flags); | ||
| 162 | wake_up(&desc->wait); | 163 | wake_up(&desc->wait); |
| 163 | } | 164 | } |
| 164 | 165 | ||
| @@ -338,7 +339,7 @@ static ssize_t wdm_write | |||
| 338 | if (we < 0) | 339 | if (we < 0) |
| 339 | return -EIO; | 340 | return -EIO; |
| 340 | 341 | ||
| 341 | desc->outbuf = buf = kmalloc(count, GFP_KERNEL); | 342 | buf = kmalloc(count, GFP_KERNEL); |
| 342 | if (!buf) { | 343 | if (!buf) { |
| 343 | rv = -ENOMEM; | 344 | rv = -ENOMEM; |
| 344 | goto outnl; | 345 | goto outnl; |
| @@ -408,10 +409,12 @@ static ssize_t wdm_write | |||
| 408 | req->wIndex = desc->inum; | 409 | req->wIndex = desc->inum; |
| 409 | req->wLength = cpu_to_le16(count); | 410 | req->wLength = cpu_to_le16(count); |
| 410 | set_bit(WDM_IN_USE, &desc->flags); | 411 | set_bit(WDM_IN_USE, &desc->flags); |
| 412 | desc->outbuf = buf; | ||
| 411 | 413 | ||
| 412 | rv = usb_submit_urb(desc->command, GFP_KERNEL); | 414 | rv = usb_submit_urb(desc->command, GFP_KERNEL); |
| 413 | if (rv < 0) { | 415 | if (rv < 0) { |
| 414 | kfree(buf); | 416 | kfree(buf); |
| 417 | desc->outbuf = NULL; | ||
| 415 | clear_bit(WDM_IN_USE, &desc->flags); | 418 | clear_bit(WDM_IN_USE, &desc->flags); |
| 416 | dev_err(&desc->intf->dev, "Tx URB error: %d\n", rv); | 419 | dev_err(&desc->intf->dev, "Tx URB error: %d\n", rv); |
| 417 | rv = usb_translate_errors(rv); | 420 | rv = usb_translate_errors(rv); |
