Fix debugfs_create_dir's error checking method for arch/sh/kernel/
PATCH 1/1 Fix debugfs_create_dir's error checking method for arch/sh/kernel/
Hi,
debugfs_create_dir() returns NULL if an error occurs, returns -ENODEV when debugfs is not enabled in the kernel.
Signed-off-by Zhao Lei <[email protected]>
--- arch/sh/kernel/setup.c | 2 ++ 1 files changed, 2 insertions(+), 0 deletions(-)
arch/sh/kernel/setup.c +2 -0
@@ -530,6 +530,8 @@ struct dentry *sh_debugfs_root;static int __init sh_debugfs_init (void ) { sh_debugfs_root =debugfs_create_dir ("sh" ,NULL ); +if (!sh_debugfs_root) +return -ENOMEM ;if (IS_ERR (sh_debugfs_root))return PTR_ERR (sh_debugfs_root);
Signature · 1 line
1.5.5.3
PATCH 1/1 Fix debugfs_create_file's error checking method for arch/sh/mm/
Hi,
debugfs_create_file() returns NULL if an error occurs, returns -ENODEV when debugfs is not enabled in the kernel.
Signed-off-by Zhao Lei <[email protected]>
--- arch/sh/mm/cache-debugfs.c | 6 ++++++ arch/sh/mm/pmb.c | 2 ++ 2 files changed, 8 insertions(+), 0 deletions(-)
arch/sh/mm/cache-debugfs.c +6 -0
@@ -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);
arch/sh/mm/pmb.c +2 -0
@@ -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);
Signature · 1 line
1.5.5.3
Paul Mundt
AppliedQuoted 4 lines · Zhaolei
debugfs_create_dir()returns NULL if an error occurs, returns-ENODEVwhen debugfs is not enabled in the kernel.Signed-off-by Zhao Lei <[email protected]>
Quoted 4 lines · Zhaolei
debugfs_create_file()returns NULL if an error occurs, returns-ENODEVwhen debugfs is not enabled in the kernel.Signed-off-by Zhao Lei <[email protected]>
Applied, thanks.