Merge pull request #258 from visitorckw/fix-vinput

vinput: Fix multiple issue
This commit is contained in:
Jim Huang 2024-05-15 05:54:44 +08:00 committed by GitHub
commit e1eced6d2f
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194

View File

@ -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);