From d81d968b0e181a93d225028b4741bf2fe060bd94 Mon Sep 17 00:00:00 2001 From: Chih-En Lin Date: Fri, 4 Nov 2022 01:16:14 +0800 Subject: [PATCH] vinput: Fix missing error code Fix the missing error code when register_chrdev() failed. The report is from Smatch: Smatch failed: 1 warning(s), 0 error(s) /home/runner/work/lkmpg/lkmpg/examples/vinput.c:372 vinput_init() warn: missing error code 'err' --- examples/vinput.c | 1 + 1 file changed, 1 insertion(+) diff --git a/examples/vinput.c b/examples/vinput.c index b692d3f..21bd9aa 100644 --- a/examples/vinput.c +++ b/examples/vinput.c @@ -369,6 +369,7 @@ static int __init vinput_init(void) vinput_dev = register_chrdev(0, DRIVER_NAME, &vinput_fops); if (vinput_dev < 0) { pr_err("vinput: Unable to allocate char dev region\n"); + err = vinput_dev; goto failed_alloc; }