summaryrefslogtreecommitdiff
path: root/drivers/usb
diff options
context:
space:
mode:
authorMichal Nazarewicz <mina86@mina86.com>2016-01-04 23:28:34 +0300
committerFelipe Balbi <balbi@kernel.org>2016-03-04 16:14:31 +0300
commit3163c79efa653ea9832acb8efe55efd34a5f4ae6 (patch)
tree0411d4149db3bf8ecd68ead87d493de779ee74b2 /drivers/usb
parent3de4e20568171f542adb8d54a47c46ff025ca942 (diff)
downloadlinux-3163c79efa653ea9832acb8efe55efd34a5f4ae6.tar.xz
usb: f_fs: fix ffs_epfile_io returning success on req alloc failure
In the AIO path, if allocating of a request failse, the function simply goes to the error_lock path whose end result is returning value of ret. However, at this point ret’s value is zero (assigned as return value from ffs_mutex_lock). Fix by adding ‘ret = -ENOMEM’ statement. Signed-off-by: Michal Nazarewicz <mina86@mina86.com> Signed-off-by: Felipe Balbi <balbi@kernel.org>
Diffstat (limited to 'drivers/usb')
-rw-r--r--drivers/usb/gadget/function/f_fs.c4
1 files changed, 3 insertions, 1 deletions
diff --git a/drivers/usb/gadget/function/f_fs.c b/drivers/usb/gadget/function/f_fs.c
index d1a4a8645620..13842205b849 100644
--- a/drivers/usb/gadget/function/f_fs.c
+++ b/drivers/usb/gadget/function/f_fs.c
@@ -793,8 +793,10 @@ 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))
+ if (unlikely(!req)) {
+ ret = -ENOMEM;
goto error_lock;
+ }
req->buf = data;
req->length = data_len;