hc
2024-10-22 8ac6c7a54ed1b98d142dce24b11c6de6a1e239a5
kernel/lib/notifier-error-inject.c
....@@ -1,3 +1,4 @@
1
+// SPDX-License-Identifier: GPL-2.0-only
12 #include <linux/module.h>
23
34 #include "notifier-error-inject.h"
....@@ -14,7 +15,7 @@
1415 return 0;
1516 }
1617
17
-DEFINE_SIMPLE_ATTRIBUTE(fops_errno, debugfs_errno_get, debugfs_errno_set,
18
+DEFINE_SIMPLE_ATTRIBUTE_SIGNED(fops_errno, debugfs_errno_get, debugfs_errno_set,
1819 "%lld\n");
1920
2021 static struct dentry *debugfs_create_errno(const char *name, umode_t mode,
....@@ -58,33 +59,22 @@
5859 err_inject->nb.priority = priority;
5960
6061 dir = debugfs_create_dir(name, parent);
61
- if (!dir)
62
- return ERR_PTR(-ENOMEM);
6362
6463 actions_dir = debugfs_create_dir("actions", dir);
65
- if (!actions_dir)
66
- goto fail;
6764
6865 for (action = err_inject->actions; action->name; action++) {
6966 struct dentry *action_dir;
7067
7168 action_dir = debugfs_create_dir(action->name, actions_dir);
72
- if (!action_dir)
73
- goto fail;
7469
7570 /*
7671 * Create debugfs r/w file containing action->error. If
7772 * notifier call chain is called with action->val, it will
7873 * fail with the error code
7974 */
80
- if (!debugfs_create_errno("error", mode, action_dir,
81
- &action->error))
82
- goto fail;
75
+ debugfs_create_errno("error", mode, action_dir, &action->error);
8376 }
8477 return dir;
85
-fail:
86
- debugfs_remove_recursive(dir);
87
- return ERR_PTR(-ENOMEM);
8878 }
8979 EXPORT_SYMBOL_GPL(notifier_err_inject_init);
9080