mirror of
https://github.com/BobTheBlinker/android_kernel_motorola_sm6375.git
synced 2026-10-29 19:21:31 -04:00
gpio: mockup: return -EFAULT if copy_from_user() fails
copy_from_user() returns the number of bytes remaining to be copied but
we want to return negative error codes on failue.
Fixes: 9202ba2397 ("gpio: mockup: implement event injecting over debugfs")
Signed-off-by: Dan Carpenter <[email protected]>
Acked-by: Bartosz Golaszewski <[email protected]>
Signed-off-by: Linus Walleij <[email protected]>
This commit is contained in:
parent
9ce9f79997
commit
fa6256db03
1 changed files with 3 additions and 4 deletions
|
|
@ -197,7 +197,7 @@ static ssize_t gpio_mockup_event_write(struct file *file,
|
|||
struct seq_file *sfile;
|
||||
struct gpio_desc *desc;
|
||||
struct gpio_chip *gc;
|
||||
int status, val;
|
||||
int val;
|
||||
char buf;
|
||||
|
||||
sfile = file->private_data;
|
||||
|
|
@ -206,9 +206,8 @@ static ssize_t gpio_mockup_event_write(struct file *file,
|
|||
chip = priv->chip;
|
||||
gc = &chip->gc;
|
||||
|
||||
status = copy_from_user(&buf, usr_buf, 1);
|
||||
if (status)
|
||||
return status;
|
||||
if (copy_from_user(&buf, usr_buf, 1))
|
||||
return -EFAULT;
|
||||
|
||||
if (buf == '0')
|
||||
val = 0;
|
||||
|
|
|
|||
Loading…
Reference in a new issue