diff options
Diffstat (limited to 'lib/fault-inject.c')
-rw-r--r-- | lib/fault-inject.c | 20 |
1 files changed, 7 insertions, 13 deletions
diff --git a/lib/fault-inject.c b/lib/fault-inject.c index 2577b121c7c1..f193b7796449 100644 --- a/lib/fault-inject.c +++ b/lib/fault-inject.c | |||
@@ -197,21 +197,15 @@ static struct dentry *debugfs_create_atomic_t(const char *name, mode_t mode, | |||
197 | return debugfs_create_file(name, mode, parent, value, &fops_atomic_t); | 197 | return debugfs_create_file(name, mode, parent, value, &fops_atomic_t); |
198 | } | 198 | } |
199 | 199 | ||
200 | void cleanup_fault_attr_dentries(struct fault_attr *attr) | 200 | struct dentry *fault_create_debugfs_attr(const char *name, |
201 | { | 201 | struct dentry *parent, struct fault_attr *attr) |
202 | debugfs_remove_recursive(attr->dir); | ||
203 | } | ||
204 | |||
205 | int init_fault_attr_dentries(struct fault_attr *attr, const char *name) | ||
206 | { | 202 | { |
207 | mode_t mode = S_IFREG | S_IRUSR | S_IWUSR; | 203 | mode_t mode = S_IFREG | S_IRUSR | S_IWUSR; |
208 | struct dentry *dir; | 204 | struct dentry *dir; |
209 | 205 | ||
210 | dir = debugfs_create_dir(name, NULL); | 206 | dir = debugfs_create_dir(name, parent); |
211 | if (!dir) | 207 | if (!dir) |
212 | return -ENOMEM; | 208 | return ERR_PTR(-ENOMEM); |
213 | |||
214 | attr->dir = dir; | ||
215 | 209 | ||
216 | if (!debugfs_create_ul("probability", mode, dir, &attr->probability)) | 210 | if (!debugfs_create_ul("probability", mode, dir, &attr->probability)) |
217 | goto fail; | 211 | goto fail; |
@@ -243,11 +237,11 @@ int init_fault_attr_dentries(struct fault_attr *attr, const char *name) | |||
243 | 237 | ||
244 | #endif /* CONFIG_FAULT_INJECTION_STACKTRACE_FILTER */ | 238 | #endif /* CONFIG_FAULT_INJECTION_STACKTRACE_FILTER */ |
245 | 239 | ||
246 | return 0; | 240 | return dir; |
247 | fail: | 241 | fail: |
248 | debugfs_remove_recursive(attr->dir); | 242 | debugfs_remove_recursive(dir); |
249 | 243 | ||
250 | return -ENOMEM; | 244 | return ERR_PTR(-ENOMEM); |
251 | } | 245 | } |
252 | 246 | ||
253 | #endif /* CONFIG_FAULT_INJECTION_DEBUG_FS */ | 247 | #endif /* CONFIG_FAULT_INJECTION_DEBUG_FS */ |