aboutsummaryrefslogtreecommitdiffstats
path: root/arch/sh/mm
diff options
context:
space:
mode:
authorZhaolei <zhaolei@cn.fujitsu.com>2008-10-17 07:25:09 -0400
committerPaul Mundt <lethal@linux-sh.org>2008-10-19 21:40:21 -0400
commit25627c7fd71269e2658b6872eef65719ee80b9aa (patch)
tree9f5b6f11354ef176348a42aa969c93b3f5794f8f /arch/sh/mm
parent9986b311efdc9727a5a48f03c3dac3d536fbaa74 (diff)
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>
Diffstat (limited to 'arch/sh/mm')
-rw-r--r--arch/sh/mm/cache-debugfs.c6
-rw-r--r--arch/sh/mm/pmb.c2
2 files changed, 8 insertions, 0 deletions
diff --git a/arch/sh/mm/cache-debugfs.c b/arch/sh/mm/cache-debugfs.c
index 0e189ccd4a77..5ba067b26591 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)
130 dcache_dentry = debugfs_create_file("dcache", S_IRUSR, sh_debugfs_root, 130 dcache_dentry = debugfs_create_file("dcache", S_IRUSR, sh_debugfs_root,
131 (unsigned int *)CACHE_TYPE_DCACHE, 131 (unsigned int *)CACHE_TYPE_DCACHE,
132 &cache_debugfs_fops); 132 &cache_debugfs_fops);
133 if (!dcache_dentry)
134 return -ENOMEM;
133 if (IS_ERR(dcache_dentry)) 135 if (IS_ERR(dcache_dentry))
134 return PTR_ERR(dcache_dentry); 136 return PTR_ERR(dcache_dentry);
135 137
136 icache_dentry = debugfs_create_file("icache", S_IRUSR, sh_debugfs_root, 138 icache_dentry = debugfs_create_file("icache", S_IRUSR, sh_debugfs_root,
137 (unsigned int *)CACHE_TYPE_ICACHE, 139 (unsigned int *)CACHE_TYPE_ICACHE,
138 &cache_debugfs_fops); 140 &cache_debugfs_fops);
141 if (!icache_dentry) {
142 debugfs_remove(dcache_dentry);
143 return -ENOMEM;
144 }
139 if (IS_ERR(icache_dentry)) { 145 if (IS_ERR(icache_dentry)) {
140 debugfs_remove(dcache_dentry); 146 debugfs_remove(dcache_dentry);
141 return PTR_ERR(icache_dentry); 147 return PTR_ERR(icache_dentry);
diff --git a/arch/sh/mm/pmb.c b/arch/sh/mm/pmb.c
index cef727669c87..84241676265e 100644
--- a/arch/sh/mm/pmb.c
+++ b/arch/sh/mm/pmb.c
@@ -394,6 +394,8 @@ static int __init pmb_debugfs_init(void)
394 394
395 dentry = debugfs_create_file("pmb", S_IFREG | S_IRUGO, 395 dentry = debugfs_create_file("pmb", S_IFREG | S_IRUGO,
396 sh_debugfs_root, NULL, &pmb_debugfs_fops); 396 sh_debugfs_root, NULL, &pmb_debugfs_fops);
397 if (!dentry)
398 return -ENOMEM;
397 if (IS_ERR(dentry)) 399 if (IS_ERR(dentry))
398 return PTR_ERR(dentry); 400 return PTR_ERR(dentry);
399 401