usb: gadget: f_fs: add missing spinlock and mutex unlock
[firefly-linux-kernel-4.4.55.git] / drivers / usb / gadget / f_fs.c
index 10c086afa2f44029e2121017f2a725a9722029bb..2e164dca08e89fc29ea1887f0afe7b2a09e1a5af 100644 (file)
@@ -802,7 +802,7 @@ static ssize_t ffs_epfile_io(struct file *file, struct ffs_io_data *io_data)
                if (io_data->aio) {
                        req = usb_ep_alloc_request(ep->ep, GFP_KERNEL);
                        if (unlikely(!req))
-                               goto error;
+                               goto error_lock;
 
                        req->buf      = data;
                        req->length   = io_data->len;
@@ -817,7 +817,7 @@ static ssize_t ffs_epfile_io(struct file *file, struct ffs_io_data *io_data)
                        ret = usb_ep_queue(ep->ep, req, GFP_ATOMIC);
                        if (unlikely(ret)) {
                                usb_ep_free_request(ep->ep, req);
-                               goto error;
+                               goto error_lock;
                        }
                        ret = -EIOCBQUEUED;
 
@@ -865,6 +865,10 @@ static ssize_t ffs_epfile_io(struct file *file, struct ffs_io_data *io_data)
 
        mutex_unlock(&epfile->mutex);
        return ret;
+
+error_lock:
+       spin_unlock_irq(&epfile->ffs->eps_lock);
+       mutex_unlock(&epfile->mutex);
 error:
        kfree(data);
        return ret;