diff --git a/examples/vinput.c b/examples/vinput.c index d7d2d238..51a1396b 100644 --- a/examples/vinput.c +++ b/examples/vinput.c @@ -177,6 +177,11 @@ static struct vinput *vinput_alloc_vdevice(void) int err; struct vinput *vinput = kzalloc(sizeof(struct vinput), GFP_KERNEL); + if (!vinput) { + pr_err("vinput: Cannot allocate vinput input device\n"); + return ERR_PTR(-ENOMEM); + } + try_module_get(THIS_MODULE); spin_lock_init(&vinput->lock);