From: Michal Nazarewicz Date: Mon, 4 Jan 2016 20:28:34 +0000 (+0100) Subject: usb: f_fs: fix ffs_epfile_io returning success on req alloc failure X-Git-Tag: next-20160307~24^2^2~57 X-Git-Url: https://git.karo-electronics.de/?a=commitdiff_plain;h=3163c79efa653ea9832acb8efe55efd34a5f4ae6;p=karo-tx-linux.git 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 Signed-off-by: Felipe Balbi --- 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;