Fix debugfs_create_file's error checking method for arch/sh/mm/

Previous message: [thread] [date] [author]
Next message: [thread] [date] [author]
From: Linux Kernel Mailing List
Date: Monday, October 20, 2008 - 10:14 am

Gitweb:     http://git.kernel.org/git/?p=linux/kernel/git/torvalds/linux-2.6.git;a=commit;h=25627c...
Commit:     25627c7fd71269e2658b6872eef65719ee80b9aa
Parent:     9986b311efdc9727a5a48f03c3dac3d536fbaa74
Author:     Zhaolei <zhaolei@cn.fujitsu.com>
AuthorDate: Fri Oct 17 19:25:09 2008 +0800
Committer:  Paul Mundt <lethal@linux-sh.org>
CommitDate: Mon Oct 20 10:40:21 2008 +0900

    Fix debugfs_create_file's error checking method for arch/sh/mm/
    
    debugfs_create_file() returns NULL if an error occurs, returns -ENODEV
    when debugfs is not enabled in the kernel.
    
    Signed-off-by: Zhao Lei <zhaolei@cn.fujitsu.com>
    Signed-off-by: Paul Mundt <lethal@linux-sh.org>
---
 arch/sh/mm/cache-debugfs.c |    6 ++++++
 arch/sh/mm/pmb.c           |    2 ++
 2 files changed, 8 insertions(+), 0 deletions(-)

diff --git a/arch/sh/mm/cache-debugfs.c b/arch/sh/mm/cache-debugfs.c
index 0e189cc..5ba067b 100644
--- a/arch/sh/mm/cache-debugfs.c
+++ b/arch/sh/mm/cache-debugfs.c
@@ -130,12 +130,18 @@ static int __init cache_debugfs_init(void)
 	dcache_dentry = debugfs_create_file("dcache", S_IRUSR, sh_debugfs_root,
 					    (unsigned int *)CACHE_TYPE_DCACHE,
 					    &cache_debugfs_fops);
+	if (!dcache_dentry)
+		return -ENOMEM;
 	if (IS_ERR(dcache_dentry))
 		return PTR_ERR(dcache_dentry);
 
 	icache_dentry = debugfs_create_file("icache", S_IRUSR, sh_debugfs_root,
 					    (unsigned int *)CACHE_TYPE_ICACHE,
 					    &cache_debugfs_fops);
+	if (!icache_dentry) {
+		debugfs_remove(dcache_dentry);
+		return -ENOMEM;
+	}
 	if (IS_ERR(icache_dentry)) {
 		debugfs_remove(dcache_dentry);
 		return PTR_ERR(icache_dentry);
diff --git a/arch/sh/mm/pmb.c b/arch/sh/mm/pmb.c
index cef7276..8424167 100644
--- a/arch/sh/mm/pmb.c
+++ b/arch/sh/mm/pmb.c
@@ -394,6 +394,8 @@ static int __init pmb_debugfs_init(void)
 
 	dentry = debugfs_create_file("pmb", S_IFREG | S_IRUGO,
 				     sh_debugfs_root, NULL, &pmb_debugfs_fops);
+	if (!dentry)
+		return -ENOMEM;
 	if (IS_ERR(dentry))
 		return PTR_ERR(dentry);
 
--
To unsubscribe from this list: send the line "unsubscribe git-commits-head" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Previous message: [thread] [date] [author]
Next message: [thread] [date] [author]

Messages in current thread:
Fix debugfs_create_file's error checking method for arch/s ..., Linux Kernel Mailing ..., (Mon Oct 20, 10:14 am)