From: Eli Billauer Date: Thu, 4 Sep 2014 14:47:47 +0000 (+0300) Subject: staging: xillybus: EAGAIN status handling improvement X-Git-Tag: v3.18-rc1~130^2~643 X-Git-Url: https://git.karo-electronics.de/?a=commitdiff_plain;h=06bda66b010324604883be715a9f46e857fa5346;p=karo-tx-linux.git 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 Signed-off-by: Eli Billauer Reviewed-by: Dan Carpenter Signed-off-by: Greg Kroah-Hartman --- diff --git a/drivers/staging/xillybus/xillybus_core.c b/drivers/staging/xillybus/xillybus_core.c index 45dbf07ec7de..f66ffa707686 100644 --- a/drivers/staging/xillybus/xillybus_core.c +++ b/drivers/staging/xillybus/xillybus_core.c @@ -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 @@ desperate: 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; }