public inbox for linux-kernel@vger.kernel.org
 help / color / mirror / Atom feed
* [PATCH 2/2] mm: memblock - Handled failure of debug fs entries creation
@ 2012-04-25 19:59 Sasikantha babu
  2012-04-26 23:21 ` Andrew Morton
  0 siblings, 1 reply; 3+ messages in thread
From: Sasikantha babu @ 2012-04-25 19:59 UTC (permalink / raw)
  To: Tejun Heo, H. Peter Anvin, Andrew Morton, Ingo Molnar
  Cc: linux-mm, linux-kernel, Sasikantha babu

1) Removed already created debug fs entries on failure

2) Fixed coding style 80 char per line

Signed-off-by: Sasikantha babu <sasikanth.v19@gmail.com>
---
 mm/memblock.c |   14 +++++++++++---
 1 files changed, 11 insertions(+), 3 deletions(-)

diff --git a/mm/memblock.c b/mm/memblock.c
index a44eab3..5553723 100644
--- a/mm/memblock.c
+++ b/mm/memblock.c
@@ -966,11 +966,19 @@ static int __init memblock_init_debugfs(void)
 {
 	struct dentry *root = debugfs_create_dir("memblock", NULL);
 	if (!root)
-		return -ENXIO;
-	debugfs_create_file("memory", S_IRUGO, root, &memblock.memory, &memblock_debug_fops);
-	debugfs_create_file("reserved", S_IRUGO, root, &memblock.reserved, &memblock_debug_fops);
+		return -ENOMEM;
+
+	if (!debugfs_create_file("memory", S_IRUGO, root, &memblock.memory,
+				&memblock_debug_fops))
+		goto fail;
+	if (!debugfs_create_file("reserved", S_IRUGO, root, &memblock.reserved,
+				&memblock_debug_fops))
+		goto fail;
 
 	return 0;
+fail:
+	debugfs_remove_recursive(root);
+	return -ENOMEM;
 }
 __initcall(memblock_init_debugfs);
 
-- 
1.7.3.4


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

end of thread, other threads:[~2012-04-28 19:05 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2012-04-25 19:59 [PATCH 2/2] mm: memblock - Handled failure of debug fs entries creation Sasikantha babu
2012-04-26 23:21 ` Andrew Morton
     [not found]   ` <CAOJFanUu_RD2UNgFg4gNuPte+jOA95ejMtq53UCo6vLaLohmQQ@mail.gmail.com>
2012-04-28 19:06     ` Andrew Morton

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox