Skip to content

Commit

Permalink
Merge pull request #258 from visitorckw/fix-vinput
Browse files Browse the repository at this point in the history
vinput: Fix multiple issue
  • Loading branch information
jserv authored May 14, 2024
2 parents 0a27a01 + 0a23ecd commit e1eced6
Showing 1 changed file with 6 additions and 3 deletions.
9 changes: 6 additions & 3 deletions examples/vinput.c
Original file line number Diff line number Diff line change
Expand Up @@ -106,7 +106,7 @@ static ssize_t vinput_read(struct file *file, char __user *buffer, size_t count,
count = len - *offset;

if (raw_copy_to_user(buffer, buff + *offset, count))
count = -EFAULT;
return -EFAULT;

*offset += count;

Expand Down Expand Up @@ -177,9 +177,12 @@ static struct vinput *vinput_alloc_vdevice(void)
int err;
struct vinput *vinput = kzalloc(sizeof(struct vinput), GFP_KERNEL);

try_module_get(THIS_MODULE);
if (!vinput) {
pr_err("vinput: Cannot allocate vinput input device\n");
return ERR_PTR(-ENOMEM);
}

memset(vinput, 0, sizeof(struct vinput));
try_module_get(THIS_MODULE);

spin_lock_init(&vinput->lock);

Expand Down

0 comments on commit e1eced6

Please sign in to comment.