summaryrefslogtreecommitdiffstats
path: root/lib/notifier-error-inject.c
diff options
context:
space:
mode:
Diffstat (limited to 'lib/notifier-error-inject.c')
-rw-r--r--lib/notifier-error-inject.c13
1 files changed, 1 insertions, 12 deletions
diff --git a/lib/notifier-error-inject.c b/lib/notifier-error-inject.c
index 3d2ba7cf83f4..21016b32d313 100644
--- a/lib/notifier-error-inject.c
+++ b/lib/notifier-error-inject.c
@@ -59,33 +59,22 @@ struct dentry *notifier_err_inject_init(const char *name, struct dentry *parent,
59 err_inject->nb.priority = priority; 59 err_inject->nb.priority = priority;
60 60
61 dir = debugfs_create_dir(name, parent); 61 dir = debugfs_create_dir(name, parent);
62 if (!dir)
63 return ERR_PTR(-ENOMEM);
64 62
65 actions_dir = debugfs_create_dir("actions", dir); 63 actions_dir = debugfs_create_dir("actions", dir);
66 if (!actions_dir)
67 goto fail;
68 64
69 for (action = err_inject->actions; action->name; action++) { 65 for (action = err_inject->actions; action->name; action++) {
70 struct dentry *action_dir; 66 struct dentry *action_dir;
71 67
72 action_dir = debugfs_create_dir(action->name, actions_dir); 68 action_dir = debugfs_create_dir(action->name, actions_dir);
73 if (!action_dir)
74 goto fail;
75 69
76 /* 70 /*
77 * Create debugfs r/w file containing action->error. If 71 * Create debugfs r/w file containing action->error. If
78 * notifier call chain is called with action->val, it will 72 * notifier call chain is called with action->val, it will
79 * fail with the error code 73 * fail with the error code
80 */ 74 */
81 if (!debugfs_create_errno("error", mode, action_dir, 75 debugfs_create_errno("error", mode, action_dir, &action->error);
82 &action->error))
83 goto fail;
84 } 76 }
85 return dir; 77 return dir;
86fail:
87 debugfs_remove_recursive(dir);
88 return ERR_PTR(-ENOMEM);
89} 78}
90EXPORT_SYMBOL_GPL(notifier_err_inject_init); 79EXPORT_SYMBOL_GPL(notifier_err_inject_init);
91 80