浏览代码

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'
Chih-En Lin 2 年之前
父节点
当前提交
d81d968b0e
共有 1 个文件被更改,包括 1 次插入0 次删除
  1. 1 0
      examples/vinput.c

+ 1 - 0
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;
     }