| .. | .. | 
|---|
|  | 1 | +// SPDX-License-Identifier: GPL-2.0-only | 
|---|
| 1 | 2 | #include <linux/module.h> | 
|---|
| 2 | 3 |  | 
|---|
| 3 | 4 | #include "notifier-error-inject.h" | 
|---|
| .. | .. | 
|---|
| 14 | 15 | return 0; | 
|---|
| 15 | 16 | } | 
|---|
| 16 | 17 |  | 
|---|
| 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, | 
|---|
| 18 | 19 | "%lld\n"); | 
|---|
| 19 | 20 |  | 
|---|
| 20 | 21 | static struct dentry *debugfs_create_errno(const char *name, umode_t mode, | 
|---|
| .. | .. | 
|---|
| 58 | 59 | err_inject->nb.priority = priority; | 
|---|
| 59 | 60 |  | 
|---|
| 60 | 61 | dir = debugfs_create_dir(name, parent); | 
|---|
| 61 |  | -	if (!dir) | 
|---|
| 62 |  | -		return ERR_PTR(-ENOMEM); | 
|---|
| 63 | 62 |  | 
|---|
| 64 | 63 | actions_dir = debugfs_create_dir("actions", dir); | 
|---|
| 65 |  | -	if (!actions_dir) | 
|---|
| 66 |  | -		goto fail; | 
|---|
| 67 | 64 |  | 
|---|
| 68 | 65 | for (action = err_inject->actions; action->name; action++) { | 
|---|
| 69 | 66 | struct dentry *action_dir; | 
|---|
| 70 | 67 |  | 
|---|
| 71 | 68 | action_dir = debugfs_create_dir(action->name, actions_dir); | 
|---|
| 72 |  | -		if (!action_dir) | 
|---|
| 73 |  | -			goto fail; | 
|---|
| 74 | 69 |  | 
|---|
| 75 | 70 | /* | 
|---|
| 76 | 71 | * Create debugfs r/w file containing action->error. If | 
|---|
| 77 | 72 | * notifier call chain is called with action->val, it will | 
|---|
| 78 | 73 | * fail with the error code | 
|---|
| 79 | 74 | */ | 
|---|
| 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); | 
|---|
| 83 | 76 | } | 
|---|
| 84 | 77 | return dir; | 
|---|
| 85 |  | -fail: | 
|---|
| 86 |  | -	debugfs_remove_recursive(dir); | 
|---|
| 87 |  | -	return ERR_PTR(-ENOMEM); | 
|---|
| 88 | 78 | } | 
|---|
| 89 | 79 | EXPORT_SYMBOL_GPL(notifier_err_inject_init); | 
|---|
| 90 | 80 |  | 
|---|