| .. | .. |
|---|
| 1 | +// SPDX-License-Identifier: GPL-2.0-only |
|---|
| 1 | 2 | #include "edac_module.h" |
|---|
| 2 | 3 | |
|---|
| 3 | 4 | static struct dentry *edac_debugfs; |
|---|
| .. | .. |
|---|
| 41 | 42 | .llseek = generic_file_llseek, |
|---|
| 42 | 43 | }; |
|---|
| 43 | 44 | |
|---|
| 44 | | -int __init edac_debugfs_init(void) |
|---|
| 45 | +void __init edac_debugfs_init(void) |
|---|
| 45 | 46 | { |
|---|
| 46 | 47 | edac_debugfs = debugfs_create_dir("edac", NULL); |
|---|
| 47 | | - if (IS_ERR(edac_debugfs)) { |
|---|
| 48 | | - edac_debugfs = NULL; |
|---|
| 49 | | - return -ENOMEM; |
|---|
| 50 | | - } |
|---|
| 51 | | - return 0; |
|---|
| 52 | 48 | } |
|---|
| 53 | 49 | |
|---|
| 54 | 50 | void edac_debugfs_exit(void) |
|---|
| .. | .. |
|---|
| 56 | 52 | debugfs_remove_recursive(edac_debugfs); |
|---|
| 57 | 53 | } |
|---|
| 58 | 54 | |
|---|
| 59 | | -int edac_create_debugfs_nodes(struct mem_ctl_info *mci) |
|---|
| 55 | +void edac_create_debugfs_nodes(struct mem_ctl_info *mci) |
|---|
| 60 | 56 | { |
|---|
| 61 | | - struct dentry *d, *parent; |
|---|
| 57 | + struct dentry *parent; |
|---|
| 62 | 58 | char name[80]; |
|---|
| 63 | 59 | int i; |
|---|
| 64 | 60 | |
|---|
| 65 | | - if (!edac_debugfs) |
|---|
| 66 | | - return -ENODEV; |
|---|
| 67 | | - |
|---|
| 68 | | - d = debugfs_create_dir(mci->dev.kobj.name, edac_debugfs); |
|---|
| 69 | | - if (!d) |
|---|
| 70 | | - return -ENOMEM; |
|---|
| 71 | | - parent = d; |
|---|
| 61 | + parent = debugfs_create_dir(mci->dev.kobj.name, edac_debugfs); |
|---|
| 72 | 62 | |
|---|
| 73 | 63 | for (i = 0; i < mci->n_layers; i++) { |
|---|
| 74 | 64 | sprintf(name, "fake_inject_%s", |
|---|
| 75 | 65 | edac_layer_name[mci->layers[i].type]); |
|---|
| 76 | | - d = debugfs_create_u8(name, S_IRUGO | S_IWUSR, parent, |
|---|
| 77 | | - &mci->fake_inject_layer[i]); |
|---|
| 78 | | - if (!d) |
|---|
| 79 | | - goto nomem; |
|---|
| 66 | + debugfs_create_u8(name, S_IRUGO | S_IWUSR, parent, |
|---|
| 67 | + &mci->fake_inject_layer[i]); |
|---|
| 80 | 68 | } |
|---|
| 81 | 69 | |
|---|
| 82 | | - d = debugfs_create_bool("fake_inject_ue", S_IRUGO | S_IWUSR, parent, |
|---|
| 83 | | - &mci->fake_inject_ue); |
|---|
| 84 | | - if (!d) |
|---|
| 85 | | - goto nomem; |
|---|
| 70 | + debugfs_create_bool("fake_inject_ue", S_IRUGO | S_IWUSR, parent, |
|---|
| 71 | + &mci->fake_inject_ue); |
|---|
| 86 | 72 | |
|---|
| 87 | | - d = debugfs_create_u16("fake_inject_count", S_IRUGO | S_IWUSR, parent, |
|---|
| 88 | | - &mci->fake_inject_count); |
|---|
| 89 | | - if (!d) |
|---|
| 90 | | - goto nomem; |
|---|
| 73 | + debugfs_create_u16("fake_inject_count", S_IRUGO | S_IWUSR, parent, |
|---|
| 74 | + &mci->fake_inject_count); |
|---|
| 91 | 75 | |
|---|
| 92 | | - d = debugfs_create_file("fake_inject", S_IWUSR, parent, |
|---|
| 93 | | - &mci->dev, |
|---|
| 94 | | - &debug_fake_inject_fops); |
|---|
| 95 | | - if (!d) |
|---|
| 96 | | - goto nomem; |
|---|
| 76 | + debugfs_create_file("fake_inject", S_IWUSR, parent, &mci->dev, |
|---|
| 77 | + &debug_fake_inject_fops); |
|---|
| 97 | 78 | |
|---|
| 98 | 79 | mci->debugfs = parent; |
|---|
| 99 | | - return 0; |
|---|
| 100 | | -nomem: |
|---|
| 101 | | - edac_debugfs_remove_recursive(mci->debugfs); |
|---|
| 102 | | - return -ENOMEM; |
|---|
| 103 | 80 | } |
|---|
| 104 | 81 | |
|---|
| 105 | 82 | /* Create a toplevel dir under EDAC's debugfs hierarchy */ |
|---|
| .. | .. |
|---|
| 141 | 118 | EXPORT_SYMBOL_GPL(edac_debugfs_create_file); |
|---|
| 142 | 119 | |
|---|
| 143 | 120 | /* Wrapper for debugfs_create_x8() */ |
|---|
| 144 | | -struct dentry *edac_debugfs_create_x8(const char *name, umode_t mode, |
|---|
| 145 | | - struct dentry *parent, u8 *value) |
|---|
| 121 | +void edac_debugfs_create_x8(const char *name, umode_t mode, |
|---|
| 122 | + struct dentry *parent, u8 *value) |
|---|
| 146 | 123 | { |
|---|
| 147 | 124 | if (!parent) |
|---|
| 148 | 125 | parent = edac_debugfs; |
|---|
| 149 | 126 | |
|---|
| 150 | | - return debugfs_create_x8(name, mode, parent, value); |
|---|
| 127 | + debugfs_create_x8(name, mode, parent, value); |
|---|
| 151 | 128 | } |
|---|
| 152 | 129 | EXPORT_SYMBOL_GPL(edac_debugfs_create_x8); |
|---|
| 153 | 130 | |
|---|
| 154 | 131 | /* Wrapper for debugfs_create_x16() */ |
|---|
| 155 | | -struct dentry *edac_debugfs_create_x16(const char *name, umode_t mode, |
|---|
| 156 | | - struct dentry *parent, u16 *value) |
|---|
| 132 | +void edac_debugfs_create_x16(const char *name, umode_t mode, |
|---|
| 133 | + struct dentry *parent, u16 *value) |
|---|
| 157 | 134 | { |
|---|
| 158 | 135 | if (!parent) |
|---|
| 159 | 136 | parent = edac_debugfs; |
|---|
| 160 | 137 | |
|---|
| 161 | | - return debugfs_create_x16(name, mode, parent, value); |
|---|
| 138 | + debugfs_create_x16(name, mode, parent, value); |
|---|
| 162 | 139 | } |
|---|
| 163 | 140 | EXPORT_SYMBOL_GPL(edac_debugfs_create_x16); |
|---|
| 141 | + |
|---|
| 142 | +/* Wrapper for debugfs_create_x32() */ |
|---|
| 143 | +void edac_debugfs_create_x32(const char *name, umode_t mode, |
|---|
| 144 | + struct dentry *parent, u32 *value) |
|---|
| 145 | +{ |
|---|
| 146 | + if (!parent) |
|---|
| 147 | + parent = edac_debugfs; |
|---|
| 148 | + |
|---|
| 149 | + debugfs_create_x32(name, mode, parent, value); |
|---|
| 150 | +} |
|---|
| 151 | +EXPORT_SYMBOL_GPL(edac_debugfs_create_x32); |
|---|