From 25627c7fd71269e2658b6872eef65719ee80b9aa Mon Sep 17 00:00:00 2001 From: Zhaolei Date: Fri, 17 Oct 2008 19:25:09 +0800 Subject: 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 Signed-off-by: Paul Mundt --- arch/sh/mm/cache-debugfs.c | 6 ++++++ 1 file changed, 6 insertions(+) (limited to 'arch/sh/mm/cache-debugfs.c') diff --git a/arch/sh/mm/cache-debugfs.c b/arch/sh/mm/cache-debugfs.c index 0e189ccd4a7..5ba067b2659 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); -- cgit v1.2.3-70-g09d2