提交 33799a6d 编写于 作者: A Amitoj Kaur Chawla 提交者: Ralf Baechle

MIPS: Modify error handling

debugfs_create_file returns NULL on error so an IS_ERR test is
incorrect here and a NULL check is required.

The Coccinelle semantic patch used to make this change is as follows:
@@
expression e;
@@

  e = debugfs_create_file(...);
if(
-    IS_ERR(e)
+    !e
    )
    {
  <+...
  return
- PTR_ERR(e)
+ -ENOMEM
  ;
  ...+>
  }
Signed-off-by: NAmitoj Kaur Chawla <amitoj1606@gmail.com>
Cc: julia.lawall@lip6.fr
Cc: linux-mips@linux-mips.org
Cc: linux-kernel@vger.kernel.org
Patchwork: https://patchwork.linux-mips.org/patch/13834/Signed-off-by: NRalf Baechle <ralf@linux-mips.org>
上级 11f76903
...@@ -73,8 +73,8 @@ static int __init sc_debugfs_init(void) ...@@ -73,8 +73,8 @@ static int __init sc_debugfs_init(void)
file = debugfs_create_file("prefetch", S_IRUGO | S_IWUSR, dir, file = debugfs_create_file("prefetch", S_IRUGO | S_IWUSR, dir,
NULL, &sc_prefetch_fops); NULL, &sc_prefetch_fops);
if (IS_ERR(file)) if (!file)
return PTR_ERR(file); return -ENOMEM;
return 0; return 0;
} }
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册