Skip to content

Commit 1b7de1d

Browse files
gregkhmpe
authored andcommitted
cxl: no need to check return value of debugfs_create functions
When calling debugfs functions, there is no need to ever check the return value. The function can work or not, but the code logic should never do something different based on this. Because there's no need to check, also make the return value of the local debugfs_create_io_x64() call void, as no one ever did anything with the return value (as they did not need to.) And make the cxl_debugfs_* calls return void as no one was even checking their return value at all. Signed-off-by: Greg Kroah-Hartman <[email protected]> Reviewed-by: Arnd Bergmann <[email protected]> Reviewed-by: Frederic Barrat <[email protected]> Acked-by: Andrew Donnellan <[email protected]> Signed-off-by: Michael Ellerman <[email protected]>
1 parent 0b1be03 commit 1b7de1d

File tree

2 files changed

+17
-34
lines changed

2 files changed

+17
-34
lines changed

drivers/misc/cxl/cxl.h

Lines changed: 6 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -912,11 +912,11 @@ void cxl_update_dedicated_ivtes_psl8(struct cxl_context *ctx);
912912

913913
#ifdef CONFIG_DEBUG_FS
914914

915-
int cxl_debugfs_init(void);
915+
void cxl_debugfs_init(void);
916916
void cxl_debugfs_exit(void);
917-
int cxl_debugfs_adapter_add(struct cxl *adapter);
917+
void cxl_debugfs_adapter_add(struct cxl *adapter);
918918
void cxl_debugfs_adapter_remove(struct cxl *adapter);
919-
int cxl_debugfs_afu_add(struct cxl_afu *afu);
919+
void cxl_debugfs_afu_add(struct cxl_afu *afu);
920920
void cxl_debugfs_afu_remove(struct cxl_afu *afu);
921921
void cxl_debugfs_add_adapter_regs_psl9(struct cxl *adapter, struct dentry *dir);
922922
void cxl_debugfs_add_adapter_regs_psl8(struct cxl *adapter, struct dentry *dir);
@@ -925,27 +925,24 @@ void cxl_debugfs_add_afu_regs_psl8(struct cxl_afu *afu, struct dentry *dir);
925925

926926
#else /* CONFIG_DEBUG_FS */
927927

928-
static inline int __init cxl_debugfs_init(void)
928+
static inline void __init cxl_debugfs_init(void)
929929
{
930-
return 0;
931930
}
932931

933932
static inline void cxl_debugfs_exit(void)
934933
{
935934
}
936935

937-
static inline int cxl_debugfs_adapter_add(struct cxl *adapter)
936+
static inline void cxl_debugfs_adapter_add(struct cxl *adapter)
938937
{
939-
return 0;
940938
}
941939

942940
static inline void cxl_debugfs_adapter_remove(struct cxl *adapter)
943941
{
944942
}
945943

946-
static inline int cxl_debugfs_afu_add(struct cxl_afu *afu)
944+
static inline void cxl_debugfs_afu_add(struct cxl_afu *afu)
947945
{
948-
return 0;
949946
}
950947

951948
static inline void cxl_debugfs_afu_remove(struct cxl_afu *afu)

drivers/misc/cxl/debugfs.c

Lines changed: 11 additions & 25 deletions
Original file line numberDiff line numberDiff line change
@@ -30,11 +30,11 @@ static int debugfs_io_u64_set(void *data, u64 val)
3030
DEFINE_DEBUGFS_ATTRIBUTE(fops_io_x64, debugfs_io_u64_get, debugfs_io_u64_set,
3131
"0x%016llx\n");
3232

33-
static struct dentry *debugfs_create_io_x64(const char *name, umode_t mode,
34-
struct dentry *parent, u64 __iomem *value)
33+
static void debugfs_create_io_x64(const char *name, umode_t mode,
34+
struct dentry *parent, u64 __iomem *value)
3535
{
36-
return debugfs_create_file_unsafe(name, mode, parent,
37-
(void __force *)value, &fops_io_x64);
36+
debugfs_create_file_unsafe(name, mode, parent, (void __force *)value,
37+
&fops_io_x64);
3838
}
3939

4040
void cxl_debugfs_add_adapter_regs_psl9(struct cxl *adapter, struct dentry *dir)
@@ -58,25 +58,22 @@ void cxl_debugfs_add_adapter_regs_psl8(struct cxl *adapter, struct dentry *dir)
5858
debugfs_create_io_x64("trace", S_IRUSR | S_IWUSR, dir, _cxl_p1_addr(adapter, CXL_PSL_TRACE));
5959
}
6060

61-
int cxl_debugfs_adapter_add(struct cxl *adapter)
61+
void cxl_debugfs_adapter_add(struct cxl *adapter)
6262
{
6363
struct dentry *dir;
6464
char buf[32];
6565

6666
if (!cxl_debugfs)
67-
return -ENODEV;
67+
return;
6868

6969
snprintf(buf, 32, "card%i", adapter->adapter_num);
7070
dir = debugfs_create_dir(buf, cxl_debugfs);
71-
if (IS_ERR(dir))
72-
return PTR_ERR(dir);
7371
adapter->debugfs = dir;
7472

7573
debugfs_create_io_x64("err_ivte", S_IRUSR, dir, _cxl_p1_addr(adapter, CXL_PSL_ErrIVTE));
7674

7775
if (adapter->native->sl_ops->debugfs_add_adapter_regs)
7876
adapter->native->sl_ops->debugfs_add_adapter_regs(adapter, dir);
79-
return 0;
8077
}
8178

8279
void cxl_debugfs_adapter_remove(struct cxl *adapter)
@@ -100,18 +97,16 @@ void cxl_debugfs_add_afu_regs_psl8(struct cxl_afu *afu, struct dentry *dir)
10097
debugfs_create_io_x64("trace", S_IRUSR | S_IWUSR, dir, _cxl_p1n_addr(afu, CXL_PSL_SLICE_TRACE));
10198
}
10299

103-
int cxl_debugfs_afu_add(struct cxl_afu *afu)
100+
void cxl_debugfs_afu_add(struct cxl_afu *afu)
104101
{
105102
struct dentry *dir;
106103
char buf[32];
107104

108105
if (!afu->adapter->debugfs)
109-
return -ENODEV;
106+
return;
110107

111108
snprintf(buf, 32, "psl%i.%i", afu->adapter->adapter_num, afu->slice);
112109
dir = debugfs_create_dir(buf, afu->adapter->debugfs);
113-
if (IS_ERR(dir))
114-
return PTR_ERR(dir);
115110
afu->debugfs = dir;
116111

117112
debugfs_create_io_x64("sr", S_IRUSR, dir, _cxl_p1n_addr(afu, CXL_PSL_SR_An));
@@ -122,28 +117,19 @@ int cxl_debugfs_afu_add(struct cxl_afu *afu)
122117

123118
if (afu->adapter->native->sl_ops->debugfs_add_afu_regs)
124119
afu->adapter->native->sl_ops->debugfs_add_afu_regs(afu, dir);
125-
126-
return 0;
127120
}
128121

129122
void cxl_debugfs_afu_remove(struct cxl_afu *afu)
130123
{
131124
debugfs_remove_recursive(afu->debugfs);
132125
}
133126

134-
int __init cxl_debugfs_init(void)
127+
void __init cxl_debugfs_init(void)
135128
{
136-
struct dentry *ent;
137-
138129
if (!cpu_has_feature(CPU_FTR_HVMODE))
139-
return 0;
140-
141-
ent = debugfs_create_dir("cxl", NULL);
142-
if (IS_ERR(ent))
143-
return PTR_ERR(ent);
144-
cxl_debugfs = ent;
130+
return;
145131

146-
return 0;
132+
cxl_debugfs = debugfs_create_dir("cxl", NULL);
147133
}
148134

149135
void cxl_debugfs_exit(void)

0 commit comments

Comments
 (0)