]> git.karo-electronics.de Git - karo-tx-linux.git/commitdiff
staging: xillybus: EAGAIN status handling improvement
authorEli Billauer <eli.billauer@gmail.com>
Thu, 4 Sep 2014 14:47:47 +0000 (17:47 +0300)
committerGreg Kroah-Hartman <gregkh@linuxfoundation.org>
Mon, 8 Sep 2014 20:58:19 +0000 (13:58 -0700)
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>
drivers/staging/xillybus/xillybus_core.c

index 45dbf07ec7de58ee1a73cf29dd8eaa41f23534f2..f66ffa7076861de4f990ce04aed8033784ae0495 100644 (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 @@ 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;
 }