summaryrefslogtreecommitdiff
path: root/drivers/input/serio/serio_raw.c
diff options
context:
space:
mode:
authorArnd Bergmann <arnd@arndb.de>2012-02-27 16:23:15 +0000
committerArnd Bergmann <arnd@arndb.de>2012-02-27 16:23:21 +0000
commita173fc693b25216c5c834978f4fafd731fd4ff94 (patch)
treef75c2fa106217cc3afd1bde6803ca77fe953bbcf /drivers/input/serio/serio_raw.c
parentd052e161c4067cf21daacb1de960a1e449babfe4 (diff)
parent759a45185ac0e4dfaf8bbfcb390ec73aca4b7a34 (diff)
Merge branch 'kirkwood/board' into next/boards
* kirkwood/board: (2 commits) ARM: kirkwood: convert uart0 to devicetree. ARM: kirkwood: add dreamplug (fdt) support. Series sent by email from Jason Cooper <jason@lakedaemon.net> Update to Linux 3.3-rc3 Signed-off-by: Arnd Bergmann <arnd@arndb.de>
Diffstat (limited to 'drivers/input/serio/serio_raw.c')
-rw-r--r--drivers/input/serio/serio_raw.c15
1 files changed, 9 insertions, 6 deletions
diff --git a/drivers/input/serio/serio_raw.c b/drivers/input/serio/serio_raw.c
index 8250299fd64f..4494233d331a 100644
--- a/drivers/input/serio/serio_raw.c
+++ b/drivers/input/serio/serio_raw.c
@@ -164,7 +164,8 @@ static ssize_t serio_raw_read(struct file *file, char __user *buffer,
struct serio_raw_client *client = file->private_data;
struct serio_raw *serio_raw = client->serio_raw;
char uninitialized_var(c);
- ssize_t retval = 0;
+ ssize_t read = 0;
+ int retval;
if (serio_raw->dead)
return -ENODEV;
@@ -180,13 +181,15 @@ static ssize_t serio_raw_read(struct file *file, char __user *buffer,
if (serio_raw->dead)
return -ENODEV;
- while (retval < count && serio_raw_fetch_byte(serio_raw, &c)) {
- if (put_user(c, buffer++))
- return -EFAULT;
- retval++;
+ while (read < count && serio_raw_fetch_byte(serio_raw, &c)) {
+ if (put_user(c, buffer++)) {
+ retval = -EFAULT;
+ break;
+ }
+ read++;
}
- return retval;
+ return read ?: retval;
}
static ssize_t serio_raw_write(struct file *file, const char __user *buffer,