summaryrefslogtreecommitdiffstats
path: root/drivers/usb/gadget/function/f_fs.c
diff options
context:
space:
mode:
authorMichal Nazarewicz2016-01-04 20:58:12 +0100
committerFelipe Balbi2016-03-04 14:14:32 +0100
commitb3591f67b9f9607fea5d854f9d481f44696d8ddc (patch)
tree2ffd69f95f7805506c51935d6ddaf8923aeb3e6c /drivers/usb/gadget/function/f_fs.c
parentusb: f_fs: fix ffs_epfile_io returning success on req alloc failure (diff)
downloadkernel-qcow2-linux-b3591f67b9f9607fea5d854f9d481f44696d8ddc.tar.gz
kernel-qcow2-linux-b3591f67b9f9607fea5d854f9d481f44696d8ddc.tar.xz
kernel-qcow2-linux-b3591f67b9f9607fea5d854f9d481f44696d8ddc.zip
usb: f_fs: replace unnecessary goto with a return
In ffs_epfile_io error label points to a return path which includes a kfree(data) call. However, at the beginning of the function data is always NULL so some of the early ‘goto error’ can safely be replaced with a trivial return statement. Signed-off-by: Michal Nazarewicz <mina86@mina86.com> Signed-off-by: Felipe Balbi <balbi@kernel.org>
Diffstat (limited to 'drivers/usb/gadget/function/f_fs.c')
-rw-r--r--drivers/usb/gadget/function/f_fs.c24
1 files changed, 8 insertions, 16 deletions
diff --git a/drivers/usb/gadget/function/f_fs.c b/drivers/usb/gadget/function/f_fs.c
index 13842205b849..c4e6395c1271 100644
--- a/drivers/usb/gadget/function/f_fs.c
+++ b/drivers/usb/gadget/function/f_fs.c
@@ -690,32 +690,24 @@ static ssize_t ffs_epfile_io(struct file *file, struct ffs_io_data *io_data)
int halt;
/* Are we still active? */
- if (WARN_ON(epfile->ffs->state != FFS_ACTIVE)) {
- ret = -ENODEV;
- goto error;
- }
+ if (WARN_ON(epfile->ffs->state != FFS_ACTIVE))
+ return -ENODEV;
/* Wait for endpoint to be enabled */
ep = epfile->ep;
if (!ep) {
- if (file->f_flags & O_NONBLOCK) {
- ret = -EAGAIN;
- goto error;
- }
+ if (file->f_flags & O_NONBLOCK)
+ return -EAGAIN;
ret = wait_event_interruptible(epfile->wait, (ep = epfile->ep));
- if (ret) {
- ret = -EINTR;
- goto error;
- }
+ if (ret)
+ return -EINTR;
}
/* Do we halt? */
halt = (!io_data->read == !epfile->in);
- if (halt && epfile->isoc) {
- ret = -EINVAL;
- goto error;
- }
+ if (halt && epfile->isoc)
+ return -EINVAL;
/* Allocate & copy */
if (!halt) {