Skip to contentSkip to conversation

fsi: core: Fix return of error values on failures

PATCH In review Colin King 2 participants 2 messages Jun 3, 2021 – Jun 4, 2021

Subsystems (2)
lore
Share & tools
lore

Colin King

author
#0 lore raw

PATCH 1/1 fsi: core: Fix return of error values on failures

From: Colin Ian King <[email protected]>

Currently the cfam_read and cfam_write functions return the provided number of bytes given in the count parameter and not the error return code in variable rc, hence all failures of read/writes are being silently ignored. Fix this by returning the error code in rc.

Addresses-Coverity: ("Unused value")

Fixes d1dcd6782576 ("fsi: Add cfam char devices")
---
 drivers/fsi/fsi-core.c | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)
drivers/fsi/fsi-core.c +2 -2
index 4e60e84cd17a..59ddc9fd5bca 100644
@@ -724,7 +724,7 @@ static ssize_t cfam_read(struct file *filep, char __user *buf, size_t count,
 	rc = count;
  fail:
 	*offset = off;
-	return count;
+	return rc;
 }
 
 static ssize_t cfam_write(struct file *filep, const char __user *buf,
@@ -761,7 +761,7 @@ static ssize_t cfam_write(struct file *filep, const char __user *buf,
 	rc = count;
  fail:
 	*offset = off;
-	return count;
+	return rc;
 }
 
 static loff_t cfam_llseek(struct file *file, loff_t offset, int whence)
Signature · 1 line
2.31.1
Reviewed-by on v1 1/1
#1 lore raw

Hi Colin,

Quoted 4 lines

Currently the cfam_read and cfam_write functions return the provided number of bytes given in the count parameter and not the error return code in variable rc, hence all failures of read/writes are being silently ignored. Fix this by returning the error code in rc.

Looks good to me, thanks for the fix.

Cheers,

Jeremy