瀏覽代碼

Merge pull request #280 from NOVBobLee/fix_err_handle

Fix missing function call in error handling path
Jim Huang 5 月之前
父節點
當前提交
9c39011c21
共有 1 個文件被更改,包括 1 次插入0 次删除
  1. 1 0
      examples/hello-sysfs.c

+ 1 - 0
examples/hello-sysfs.c

@@ -42,6 +42,7 @@ static int __init mymodule_init(void)
 
     error = sysfs_create_file(mymodule, &myvariable_attribute.attr);
     if (error) {
+        kobject_put(mymodule);
         pr_info("failed to create the myvariable file "
                 "in /sys/kernel/mymodule\n");
     }