mirror of
https://github.com/sysprog21/lkmpg.git
synced 2024-11-22 10:18:46 +08:00
Merge pull request #258 from visitorckw/fix-vinput
vinput: Fix multiple issue
This commit is contained in:
commit
e1eced6d2f
|
@ -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;
|
||||
|
||||
|
@ -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);
|
||||
|
||||
|
|
Loading…
Reference in New Issue
Block a user