summaryrefslogtreecommitdiffstatshomepage
path: root/mm/hwpoison-inject.c
diff options
context:
space:
mode:
authorGreg Kroah-Hartman <gregkh@linuxfoundation.org>2019-01-22 06:21:10 -0900
committerGreg Kroah-Hartman <gregkh@linuxfoundation.org>2019-06-03 05:39:40 -0800
commit2fcc6e202a9d45f1556365ee4f4de973e1c834ec (patch)
tree55fac0c42a918e8cf697b89b359d96a22db9b3c8 /mm/hwpoison-inject.c
parent282401df902465186ff6ed5a7ba4894c589553f2 (diff)
downloadlinux-stable-2fcc6e202a9d45f1556365ee4f4de973e1c834ec.tar.gz
linux-stable-2fcc6e202a9d45f1556365ee4f4de973e1c834ec.tar.bz2
linux-stable-2fcc6e202a9d45f1556365ee4f4de973e1c834ec.tar.xz
linux-stable-2fcc6e202a9d45f1556365ee4f4de973e1c834ec.zip
hwpoison-inject: 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. Cc: Naoya Horiguchi <n-horiguchi@ah.jp.nec.com> Cc: linux-mm@kvack.org Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
Diffstat (limited to 'mm/hwpoison-inject.c')
-rw-r--r--mm/hwpoison-inject.c67
1 files changed, 22 insertions, 45 deletions
diff --git a/mm/hwpoison-inject.c b/mm/hwpoison-inject.c
index 1a7497d015b2..5b7430bd83a6 100644
--- a/mm/hwpoison-inject.c
+++ b/mm/hwpoison-inject.c
@@ -77,63 +77,40 @@ static void pfn_inject_exit(void)
77 77
78static int pfn_inject_init(void) 78static int pfn_inject_init(void)
79{ 79{
80 struct dentry *dentry;
81
82 hwpoison_dir = debugfs_create_dir("hwpoison", NULL); 80 hwpoison_dir = debugfs_create_dir("hwpoison", NULL);
83 if (hwpoison_dir == NULL)
84 return -ENOMEM;
85 81
86 /* 82 /*
87 * Note that the below poison/unpoison interfaces do not involve 83 * Note that the below poison/unpoison interfaces do not involve
88 * hardware status change, hence do not require hardware support. 84 * hardware status change, hence do not require hardware support.
89 * They are mainly for testing hwpoison in software level. 85 * They are mainly for testing hwpoison in software level.
90 */ 86 */
91 dentry = debugfs_create_file("corrupt-pfn", 0200, hwpoison_dir, 87 debugfs_create_file("corrupt-pfn", 0200, hwpoison_dir, NULL,
92 NULL, &hwpoison_fops); 88 &hwpoison_fops);
93 if (!dentry) 89
94 goto fail; 90 debugfs_create_file("unpoison-pfn", 0200, hwpoison_dir, NULL,
95 91 &unpoison_fops);
96 dentry = debugfs_create_file("unpoison-pfn", 0200, hwpoison_dir, 92
97 NULL, &unpoison_fops); 93 debugfs_create_u32("corrupt-filter-enable", 0600, hwpoison_dir,
98 if (!dentry) 94 &hwpoison_filter_enable);
99 goto fail; 95
100 96 debugfs_create_u32("corrupt-filter-dev-major", 0600, hwpoison_dir,
101 dentry = debugfs_create_u32("corrupt-filter-enable", 0600, 97 &hwpoison_filter_dev_major);
102 hwpoison_dir, &hwpoison_filter_enable); 98
103 if (!dentry) 99 debugfs_create_u32("corrupt-filter-dev-minor", 0600, hwpoison_dir,
104 goto fail; 100 &hwpoison_filter_dev_minor);
105 101
106 dentry = debugfs_create_u32("corrupt-filter-dev-major", 0600, 102 debugfs_create_u64("corrupt-filter-flags-mask", 0600, hwpoison_dir,
107 hwpoison_dir, &hwpoison_filter_dev_major); 103 &hwpoison_filter_flags_mask);
108 if (!dentry) 104
109 goto fail; 105 debugfs_create_u64("corrupt-filter-flags-value", 0600, hwpoison_dir,
110 106 &hwpoison_filter_flags_value);
111 dentry = debugfs_create_u32("corrupt-filter-dev-minor", 0600,
112 hwpoison_dir, &hwpoison_filter_dev_minor);
113 if (!dentry)
114 goto fail;
115
116 dentry = debugfs_create_u64("corrupt-filter-flags-mask", 0600,
117 hwpoison_dir, &hwpoison_filter_flags_mask);
118 if (!dentry)
119 goto fail;
120
121 dentry = debugfs_create_u64("corrupt-filter-flags-value", 0600,
122 hwpoison_dir, &hwpoison_filter_flags_value);
123 if (!dentry)
124 goto fail;
125 107
126#ifdef CONFIG_MEMCG 108#ifdef CONFIG_MEMCG
127 dentry = debugfs_create_u64("corrupt-filter-memcg", 0600, 109 debugfs_create_u64("corrupt-filter-memcg", 0600, hwpoison_dir,
128 hwpoison_dir, &hwpoison_filter_memcg); 110 &hwpoison_filter_memcg);
129 if (!dentry)
130 goto fail;
131#endif 111#endif
132 112
133 return 0; 113 return 0;
134fail:
135 pfn_inject_exit();
136 return -ENOMEM;
137} 114}
138 115
139module_init(pfn_inject_init); 116module_init(pfn_inject_init);