[<prev] [next>] [day] [month] [year] [list]
Message-ID: <20160729082846.GA8786@amitoj-Inspiron-3542>
Date: Fri, 29 Jul 2016 13:58:46 +0530
From: Amitoj Kaur Chawla <amitoj1606@...il.com>
To: ralf@...ux-mips.org, linux-mips@...ux-mips.org,
linux-kernel@...r.kernel.org
Cc: julia.lawall@...6.fr
Subject: [PATCH] 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@...il.com>
---
arch/mips/mm/sc-debugfs.c | 4 ++--
1 file changed, 2 insertions(+), 2 deletions(-)
diff --git a/arch/mips/mm/sc-debugfs.c b/arch/mips/mm/sc-debugfs.c
index 5eefe32..01f1154 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)
file = debugfs_create_file("prefetch", S_IRUGO | S_IWUSR, dir,
NULL, &sc_prefetch_fops);
- if (IS_ERR(file))
- return PTR_ERR(file);
+ if (!file)
+ return -ENOMEM;
return 0;
}
--
1.9.1
Powered by blists - more mailing lists