Skip to content

Commit

Permalink
---
Browse files Browse the repository at this point in the history
yaml
---
r: 287232
b: refs/heads/master
c: 7a0a27d
h: refs/heads/master
v: v3
  • Loading branch information
Che-Liang Chiou authored and Dmitry Torokhov committed Feb 1, 2012
1 parent f7cbedc commit a6f908a
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 7 deletions.
2 changes: 1 addition & 1 deletion [refs]
Original file line number Diff line number Diff line change
@@ -1,2 +1,2 @@
---
refs/heads/master: d04df0232d6b5172dc1958df1829abd0214c8969
refs/heads/master: 7a0a27d2ce38aee19a31fee8c12095f586eed393
15 changes: 9 additions & 6 deletions trunk/drivers/input/serio/serio_raw.c
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand All @@ -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,
Expand Down

0 comments on commit a6f908a

Please sign in to comment.