diff options
author | Amitoj Kaur Chawla <amitoj1606@gmail.com> | 2016-07-29 04:28:46 -0400 |
---|---|---|
committer | Ralf Baechle <ralf@linux-mips.org> | 2016-08-01 16:54:48 -0400 |
commit | 33799a6d1aeb892862d5f69ee87195becabf8d0c (patch) | |
tree | fa54fb209fae92fe9636b28474fa5a3fe2e7c253 | |
parent | 11f769039e1d10652bb45e83ecaad18a8681d5e5 (diff) |
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: Amitoj 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: Ralf Baechle <ralf@linux-mips.org>
-rw-r--r-- | arch/mips/mm/sc-debugfs.c | 4 |
1 files changed, 2 insertions, 2 deletions
diff --git a/arch/mips/mm/sc-debugfs.c b/arch/mips/mm/sc-debugfs.c index 5eefe3281b24..01f1154cdb0c 100644 --- a/arch/mips/mm/sc-debugfs.c +++ b/arch/mips/mm/sc-debugfs.c | |||
@@ -73,8 +73,8 @@ static int __init sc_debugfs_init(void) | |||
73 | 73 | ||
74 | file = debugfs_create_file("prefetch", S_IRUGO | S_IWUSR, dir, | 74 | file = debugfs_create_file("prefetch", S_IRUGO | S_IWUSR, dir, |
75 | NULL, &sc_prefetch_fops); | 75 | NULL, &sc_prefetch_fops); |
76 | if (IS_ERR(file)) | 76 | if (!file) |
77 | return PTR_ERR(file); | 77 | return -ENOMEM; |
78 | 78 | ||
79 | return 0; | 79 | return 0; |
80 | } | 80 | } |