diff options
author | Zhaolei <zhaolei@cn.fujitsu.com> | 2008-10-17 13:25:09 +0200 |
---|---|---|
committer | Paul Mundt <lethal@linux-sh.org> | 2008-10-20 03:40:21 +0200 |
commit | 25627c7fd71269e2658b6872eef65719ee80b9aa (patch) | |
tree | 9f5b6f11354ef176348a42aa969c93b3f5794f8f /arch/sh/mm/cache-debugfs.c | |
parent | Fix debugfs_create_dir's error checking method for arch/sh/kernel/ (diff) | |
download | linux-25627c7fd71269e2658b6872eef65719ee80b9aa.tar.xz linux-25627c7fd71269e2658b6872eef65719ee80b9aa.zip |
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/cache-debugfs.c')
-rw-r--r-- | arch/sh/mm/cache-debugfs.c | 6 |
1 files changed, 6 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) 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); |