Skip to content

Commit

Permalink
Fix debugfs_create_file's error checking method for arch/sh/mm/
Browse files Browse the repository at this point in the history
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>
  • Loading branch information
Zhaolei authored and Paul Mundt committed Oct 20, 2008
1 parent 9986b31 commit 25627c7
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 0 deletions.
6 changes: 6 additions & 0 deletions arch/sh/mm/cache-debugfs.c
Original file line number Diff line number Diff line change
Expand Up @@ -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);
Expand Down
2 changes: 2 additions & 0 deletions arch/sh/mm/pmb.c
Original file line number Diff line number Diff line change
Expand Up @@ -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);

Expand Down

0 comments on commit 25627c7

Please sign in to comment.