staging: xillybus: EAGAIN status handling improvement

The -EAGAIN status is passed through an "rc" variable instead of a less
common flow.

Suggested-by: Dan Carpenter <dan.carpenter@oracle.com>
Signed-off-by: Eli Billauer <eli.billauer@gmail.com>
Reviewed-by: Dan Carpenter <dan.carpenter@oracle.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
This commit is contained in:
Eli Billauer 2014-09-04 17:47:47 +03:00 committed by Greg Kroah-Hartman
parent 5b09fc9647
commit 06bda66b01

View File

@ -833,7 +833,7 @@ static ssize_t xillybus_read(struct file *filp, char __user *userbuf,
if (ready)
goto desperate;
bytes_done = -EAGAIN;
rc = -EAGAIN;
break;
}
@ -995,6 +995,9 @@ static ssize_t xillybus_read(struct file *filp, char __user *userbuf,
if (channel->endpoint->fatal_error)
return -EIO;
if (rc)
return rc;
return bytes_done;
}
@ -1386,7 +1389,7 @@ static ssize_t xillybus_write(struct file *filp, const char __user *userbuf,
*/
if (filp->f_flags & O_NONBLOCK) {
bytes_done = -EAGAIN;
rc = -EAGAIN;
break;
}
@ -1412,6 +1415,12 @@ static ssize_t xillybus_write(struct file *filp, const char __user *userbuf,
&channel->rd_workitem,
XILLY_RX_TIMEOUT);
if (channel->endpoint->fatal_error)
return -EIO;
if (rc)
return rc;
if ((channel->rd_synchronous) && (bytes_done > 0)) {
rc = xillybus_myflush(filp->private_data, 0); /* No timeout */
@ -1419,9 +1428,6 @@ static ssize_t xillybus_write(struct file *filp, const char __user *userbuf,
return rc;
}
if (channel->endpoint->fatal_error)
return -EIO;
return bytes_done;
}