summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorGreg Kroah-Hartman <gregkh@linuxfoundation.org>2019-03-05 18:46:09 -0500
committerLinus Torvalds <torvalds@linux-foundation.org>2019-03-06 00:07:17 -0500
commitd9f7979c92f7b34469c1ca5d1f3add6681fd567c (patch)
treead8b342028e101065d752fe1fe18199766e289e3
parent0ee930e6cafa048c1925893d0ca89918b2814f2c (diff)
mm: no need to check return value of debugfs_create functions
When calling debugfs functions, there is no need to ever check the return value. The function can work or not, but the code logic should never do something different based on this. Link: http://lkml.kernel.org/r/20190122152151.16139-14-gregkh@linuxfoundation.org Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org> Cc: Michal Hocko <mhocko@suse.com> Cc: Vlastimil Babka <vbabka@suse.cz> Cc: David Rientjes <rientjes@google.com> Cc: Laura Abbott <labbott@redhat.com> Signed-off-by: Andrew Morton <akpm@linux-foundation.org> Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
-rw-r--r--mm/cma_debug.c2
-rw-r--r--mm/failslab.c14
-rw-r--r--mm/gup_benchmark.c8
-rw-r--r--mm/huge_memory.c8
-rw-r--r--mm/memblock.c3
-rw-r--r--mm/memory.c8
-rw-r--r--mm/page_alloc.c22
-rw-r--r--mm/page_owner.c8
-rw-r--r--mm/vmstat.c15
9 files changed, 24 insertions, 64 deletions
diff --git a/mm/cma_debug.c b/mm/cma_debug.c
index ad6723e9d110..b55f28fbe831 100644
--- a/mm/cma_debug.c
+++ b/mm/cma_debug.c
@@ -191,8 +191,6 @@ static int __init cma_debugfs_init(void)
191 int i; 191 int i;
192 192
193 cma_debugfs_root = debugfs_create_dir("cma", NULL); 193 cma_debugfs_root = debugfs_create_dir("cma", NULL);
194 if (!cma_debugfs_root)
195 return -ENOMEM;
196 194
197 for (i = 0; i < cma_area_count; i++) 195 for (i = 0; i < cma_area_count; i++)
198 cma_debugfs_add_one(&cma_areas[i], i); 196 cma_debugfs_add_one(&cma_areas[i], i);
diff --git a/mm/failslab.c b/mm/failslab.c
index b135ebb88b6f..ec5aad211c5b 100644
--- a/mm/failslab.c
+++ b/mm/failslab.c
@@ -48,18 +48,12 @@ static int __init failslab_debugfs_init(void)
48 if (IS_ERR(dir)) 48 if (IS_ERR(dir))
49 return PTR_ERR(dir); 49 return PTR_ERR(dir);
50 50
51 if (!debugfs_create_bool("ignore-gfp-wait", mode, dir, 51 debugfs_create_bool("ignore-gfp-wait", mode, dir,
52 &failslab.ignore_gfp_reclaim)) 52 &failslab.ignore_gfp_reclaim);
53 goto fail; 53 debugfs_create_bool("cache-filter", mode, dir,
54 if (!debugfs_create_bool("cache-filter", mode, dir, 54 &failslab.cache_filter);
55 &failslab.cache_filter))
56 goto fail;
57 55
58 return 0; 56 return 0;
59fail:
60 debugfs_remove_recursive(dir);
61
62 return -ENOMEM;
63} 57}
64 58
65late_initcall(failslab_debugfs_init); 59late_initcall(failslab_debugfs_init);
diff --git a/mm/gup_benchmark.c b/mm/gup_benchmark.c
index 5b42d3d4b60a..6c0279e70cc4 100644
--- a/mm/gup_benchmark.c
+++ b/mm/gup_benchmark.c
@@ -122,12 +122,8 @@ static const struct file_operations gup_benchmark_fops = {
122 122
123static int gup_benchmark_init(void) 123static int gup_benchmark_init(void)
124{ 124{
125 void *ret; 125 debugfs_create_file_unsafe("gup_benchmark", 0600, NULL, NULL,
126 126 &gup_benchmark_fops);
127 ret = debugfs_create_file_unsafe("gup_benchmark", 0600, NULL, NULL,
128 &gup_benchmark_fops);
129 if (!ret)
130 pr_warn("Failed to create gup_benchmark in debugfs");
131 127
132 return 0; 128 return 0;
133} 129}
diff --git a/mm/huge_memory.c b/mm/huge_memory.c
index d066f7ca1ee8..af07527cd971 100644
--- a/mm/huge_memory.c
+++ b/mm/huge_memory.c
@@ -2887,12 +2887,8 @@ DEFINE_SIMPLE_ATTRIBUTE(split_huge_pages_fops, NULL, split_huge_pages_set,
2887 2887
2888static int __init split_huge_pages_debugfs(void) 2888static int __init split_huge_pages_debugfs(void)
2889{ 2889{
2890 void *ret; 2890 debugfs_create_file("split_huge_pages", 0200, NULL, NULL,
2891 2891 &split_huge_pages_fops);
2892 ret = debugfs_create_file("split_huge_pages", 0200, NULL, NULL,
2893 &split_huge_pages_fops);
2894 if (!ret)
2895 pr_warn("Failed to create split_huge_pages in debugfs");
2896 return 0; 2892 return 0;
2897} 2893}
2898late_initcall(split_huge_pages_debugfs); 2894late_initcall(split_huge_pages_debugfs);
diff --git a/mm/memblock.c b/mm/memblock.c
index ea31045ba704..470601115892 100644
--- a/mm/memblock.c
+++ b/mm/memblock.c
@@ -2005,8 +2005,7 @@ DEFINE_SHOW_ATTRIBUTE(memblock_debug);
2005static int __init memblock_init_debugfs(void) 2005static int __init memblock_init_debugfs(void)
2006{ 2006{
2007 struct dentry *root = debugfs_create_dir("memblock", NULL); 2007 struct dentry *root = debugfs_create_dir("memblock", NULL);
2008 if (!root) 2008
2009 return -ENXIO;
2010 debugfs_create_file("memory", 0444, root, 2009 debugfs_create_file("memory", 0444, root,
2011 &memblock.memory, &memblock_debug_fops); 2010 &memblock.memory, &memblock_debug_fops);
2012 debugfs_create_file("reserved", 0444, root, 2011 debugfs_create_file("reserved", 0444, root,
diff --git a/mm/memory.c b/mm/memory.c
index 79e0173a7d70..6aff43171a7b 100644
--- a/mm/memory.c
+++ b/mm/memory.c
@@ -3334,12 +3334,8 @@ DEFINE_DEBUGFS_ATTRIBUTE(fault_around_bytes_fops,
3334 3334
3335static int __init fault_around_debugfs(void) 3335static int __init fault_around_debugfs(void)
3336{ 3336{
3337 void *ret; 3337 debugfs_create_file_unsafe("fault_around_bytes", 0644, NULL, NULL,
3338 3338 &fault_around_bytes_fops);
3339 ret = debugfs_create_file_unsafe("fault_around_bytes", 0644, NULL, NULL,
3340 &fault_around_bytes_fops);
3341 if (!ret)
3342 pr_warn("Failed to create fault_around_bytes in debugfs");
3343 return 0; 3339 return 0;
3344} 3340}
3345late_initcall(fault_around_debugfs); 3341late_initcall(fault_around_debugfs);
diff --git a/mm/page_alloc.c b/mm/page_alloc.c
index 09bf2c5f8b4b..9be9a22ebe35 100644
--- a/mm/page_alloc.c
+++ b/mm/page_alloc.c
@@ -3230,24 +3230,14 @@ static int __init fail_page_alloc_debugfs(void)
3230 3230
3231 dir = fault_create_debugfs_attr("fail_page_alloc", NULL, 3231 dir = fault_create_debugfs_attr("fail_page_alloc", NULL,
3232 &fail_page_alloc.attr); 3232 &fail_page_alloc.attr);
3233 if (IS_ERR(dir))
3234 return PTR_ERR(dir);
3235
3236 if (!debugfs_create_bool("ignore-gfp-wait", mode, dir,
3237 &fail_page_alloc.ignore_gfp_reclaim))
3238 goto fail;
3239 if (!debugfs_create_bool("ignore-gfp-highmem", mode, dir,
3240 &fail_page_alloc.ignore_gfp_highmem))
3241 goto fail;
3242 if (!debugfs_create_u32("min-order", mode, dir,
3243 &fail_page_alloc.min_order))
3244 goto fail;
3245 3233
3246 return 0; 3234 debugfs_create_bool("ignore-gfp-wait", mode, dir,
3247fail: 3235 &fail_page_alloc.ignore_gfp_reclaim);
3248 debugfs_remove_recursive(dir); 3236 debugfs_create_bool("ignore-gfp-highmem", mode, dir,
3237 &fail_page_alloc.ignore_gfp_highmem);
3238 debugfs_create_u32("min-order", mode, dir, &fail_page_alloc.min_order);
3249 3239
3250 return -ENOMEM; 3240 return 0;
3251} 3241}
3252 3242
3253late_initcall(fail_page_alloc_debugfs); 3243late_initcall(fail_page_alloc_debugfs);
diff --git a/mm/page_owner.c b/mm/page_owner.c
index 28b06524939f..925b6f44a444 100644
--- a/mm/page_owner.c
+++ b/mm/page_owner.c
@@ -625,16 +625,14 @@ static const struct file_operations proc_page_owner_operations = {
625 625
626static int __init pageowner_init(void) 626static int __init pageowner_init(void)
627{ 627{
628 struct dentry *dentry;
629
630 if (!static_branch_unlikely(&page_owner_inited)) { 628 if (!static_branch_unlikely(&page_owner_inited)) {
631 pr_info("page_owner is disabled\n"); 629 pr_info("page_owner is disabled\n");
632 return 0; 630 return 0;
633 } 631 }
634 632
635 dentry = debugfs_create_file("page_owner", 0400, NULL, 633 debugfs_create_file("page_owner", 0400, NULL, NULL,
636 NULL, &proc_page_owner_operations); 634 &proc_page_owner_operations);
637 635
638 return PTR_ERR_OR_ZERO(dentry); 636 return 0;
639} 637}
640late_initcall(pageowner_init) 638late_initcall(pageowner_init)
diff --git a/mm/vmstat.c b/mm/vmstat.c
index 83b30edc2f7f..36b56f858f0f 100644
--- a/mm/vmstat.c
+++ b/mm/vmstat.c
@@ -2121,21 +2121,14 @@ static int __init extfrag_debug_init(void)
2121 struct dentry *extfrag_debug_root; 2121 struct dentry *extfrag_debug_root;
2122 2122
2123 extfrag_debug_root = debugfs_create_dir("extfrag", NULL); 2123 extfrag_debug_root = debugfs_create_dir("extfrag", NULL);
2124 if (!extfrag_debug_root)
2125 return -ENOMEM;
2126 2124
2127 if (!debugfs_create_file("unusable_index", 0444, 2125 debugfs_create_file("unusable_index", 0444, extfrag_debug_root, NULL,
2128 extfrag_debug_root, NULL, &unusable_file_ops)) 2126 &unusable_file_ops);
2129 goto fail;
2130 2127
2131 if (!debugfs_create_file("extfrag_index", 0444, 2128 debugfs_create_file("extfrag_index", 0444, extfrag_debug_root, NULL,
2132 extfrag_debug_root, NULL, &extfrag_file_ops)) 2129 &extfrag_file_ops);
2133 goto fail;
2134 2130
2135 return 0; 2131 return 0;
2136fail:
2137 debugfs_remove_recursive(extfrag_debug_root);
2138 return -ENOMEM;
2139} 2132}
2140 2133
2141module_init(extfrag_debug_init); 2134module_init(extfrag_debug_init);