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>
This commit is contained in:

committed by
Felipe Balbi

parent
3163c79efa
commit
b3591f67b9
@@ -690,32 +690,24 @@ static ssize_t ffs_epfile_io(struct file *file, struct ffs_io_data *io_data)
|
|||||||
int halt;
|
int halt;
|
||||||
|
|
||||||
/* Are we still active? */
|
/* Are we still active? */
|
||||||
if (WARN_ON(epfile->ffs->state != FFS_ACTIVE)) {
|
if (WARN_ON(epfile->ffs->state != FFS_ACTIVE))
|
||||||
ret = -ENODEV;
|
return -ENODEV;
|
||||||
goto error;
|
|
||||||
}
|
|
||||||
|
|
||||||
/* Wait for endpoint to be enabled */
|
/* Wait for endpoint to be enabled */
|
||||||
ep = epfile->ep;
|
ep = epfile->ep;
|
||||||
if (!ep) {
|
if (!ep) {
|
||||||
if (file->f_flags & O_NONBLOCK) {
|
if (file->f_flags & O_NONBLOCK)
|
||||||
ret = -EAGAIN;
|
return -EAGAIN;
|
||||||
goto error;
|
|
||||||
}
|
|
||||||
|
|
||||||
ret = wait_event_interruptible(epfile->wait, (ep = epfile->ep));
|
ret = wait_event_interruptible(epfile->wait, (ep = epfile->ep));
|
||||||
if (ret) {
|
if (ret)
|
||||||
ret = -EINTR;
|
return -EINTR;
|
||||||
goto error;
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/* Do we halt? */
|
/* Do we halt? */
|
||||||
halt = (!io_data->read == !epfile->in);
|
halt = (!io_data->read == !epfile->in);
|
||||||
if (halt && epfile->isoc) {
|
if (halt && epfile->isoc)
|
||||||
ret = -EINVAL;
|
return -EINVAL;
|
||||||
goto error;
|
|
||||||
}
|
|
||||||
|
|
||||||
/* Allocate & copy */
|
/* Allocate & copy */
|
||||||
if (!halt) {
|
if (!halt) {
|
||||||
|
Reference in New Issue
Block a user