Commit 91081094 authored by Colin Ian King's avatar Colin Ian King Committed by Joel Stanley

fsi: core: Fix return of error values on failures

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: d1dcd678 ("fsi: Add cfam char devices")
Signed-off-by: default avatarColin Ian King <colin.king@canonical.com>
Reviewed-by: default avatarJeremy Kerr <jk@ozlabs.org>
Link: https://lore.kernel.org/r/20210603122812.83587-1-colin.king@canonical.comSigned-off-by: default avatarJoel Stanley <joel@jms.id.au>
parent 19a52178
......@@ -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)
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment