LKML Archive on lore.kernel.org
help / color / mirror / Atom feed
* [PATCH] Fix debugfs_create_dir's error checking method for arch/sh/kernel/
@ 2008-10-17 11:25 ` Zhaolei
  2008-10-20  2:41   ` Paul Mundt
  0 siblings, 1 reply; 3+ messages in thread
From: Zhaolei @ 2008-10-17 11:25 UTC (permalink / raw)
  To: lethal; +Cc: linux-sh, linux-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 <zhaolei@cn.fujitsu.com>
---
 arch/sh/kernel/setup.c |    2 ++
 1 files changed, 2 insertions(+), 0 deletions(-)

diff --git a/arch/sh/kernel/setup.c b/arch/sh/kernel/setup.c
index de83205..c41c4dc 100644
--- a/arch/sh/kernel/setup.c
+++ b/arch/sh/kernel/setup.c
@@ -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);
 
-- 
1.5.5.3



^ permalink raw reply	[flat|nested] 3+ messages in thread

* [PATCH] Fix debugfs_create_file's error checking method for arch/sh/mm/
@ 2008-10-17 11:25 Zhaolei
  2008-10-17 11:25 ` [PATCH] Fix debugfs_create_dir's error checking method for arch/sh/kernel/ Zhaolei
  0 siblings, 1 reply; 3+ messages in thread
From: Zhaolei @ 2008-10-17 11:25 UTC (permalink / raw)
  To: lethal; +Cc: linux-sh, linux-kernel

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 <zhaolei@cn.fujitsu.com>
---
 arch/sh/mm/cache-debugfs.c |    6 ++++++
 arch/sh/mm/pmb.c           |    2 ++
 2 files changed, 8 insertions(+), 0 deletions(-)

diff --git a/arch/sh/mm/cache-debugfs.c b/arch/sh/mm/cache-debugfs.c
index 0e189cc..5ba067b 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);
diff --git a/arch/sh/mm/pmb.c b/arch/sh/mm/pmb.c
index cef7276..8424167 100644
--- a/arch/sh/mm/pmb.c
+++ b/arch/sh/mm/pmb.c
@@ -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);
 
-- 
1.5.5.3



^ permalink raw reply	[flat|nested] 3+ messages in thread

* Re: [PATCH] Fix debugfs_create_dir's error checking method for arch/sh/kernel/
  2008-10-17 11:25 ` [PATCH] Fix debugfs_create_dir's error checking method for arch/sh/kernel/ Zhaolei
@ 2008-10-20  2:41   ` Paul Mundt
  0 siblings, 0 replies; 3+ messages in thread
From: Paul Mundt @ 2008-10-20  2:41 UTC (permalink / raw)
  To: Zhaolei; +Cc: linux-sh, linux-kernel

On Fri, Oct 17, 2008 at 07:25:03PM +0800, Zhaolei wrote:
> debugfs_create_dir() 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>

On Fri, Oct 17, 2008 at 07:25:09PM +0800, Zhaolei wrote:
> 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>

Applied, thanks.

^ permalink raw reply	[flat|nested] 3+ messages in thread

end of thread, other threads:[~2008-10-20  2:41 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2008-10-17 11:25 [PATCH] Fix debugfs_create_file's error checking method for arch/sh/mm/ Zhaolei
2008-10-17 11:25 ` [PATCH] Fix debugfs_create_dir's error checking method for arch/sh/kernel/ Zhaolei
2008-10-20  2:41   ` Paul Mundt

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).