[linux,dev-4.10] drivers: fsi: occ: Fix errno for canceling a read operation

Message ID 1507823993-23017-1-git-send-email-eajames@linux.vnet.ibm.com
State Accepted, archived
Headers show
Series
  • [linux,dev-4.10] drivers: fsi: occ: Fix errno for canceling a read operation
Related show

Commit Message

Eddie James Oct. 12, 2017, 3:59 p.m.
From: "Edward A. James" <eajames@us.ibm.com>

Should not return -ECANCELED when the device has been removed. Instead,
use -ENODEV.

Signed-off-by: Edward A. James <eajames@us.ibm.com>
---
 drivers/fsi/occ.c | 4 +++-
 1 file changed, 3 insertions(+), 1 deletion(-)

Patch

diff --git a/drivers/fsi/occ.c b/drivers/fsi/occ.c
index 2e64ee2..1fe1a54 100644
--- a/drivers/fsi/occ.c
+++ b/drivers/fsi/occ.c
@@ -240,8 +240,10 @@  static ssize_t occ_read_common(struct occ_client *client, char __user *ubuf,
 		spin_lock_irq(&client->lock);
 
 		if (!test_bit(XFR_COMPLETE, &xfr->flags)) {
-			if (occ->cancel || test_bit(XFR_CANCELED, &xfr->flags))
+			if (test_bit(XFR_CANCELED, &xfr->flags))
 				rc = -ECANCELED;
+			else if (occ->cancel)
+				rc = -ENODEV;
 			else
 				rc = -EINTR;