Skip to content

Commit 4a14abc

Browse files
committed
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. Cc: linuxppc-dev@lists.ozlabs.org Acked-by: Andrew Donnellan <ajd@linux.ibm.com> Reviewed-by: Frederic Barrat <fbarrat@linux.ibm.com> Reviewed-by: Arnd Bergmann <arnd@arndb.de> Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
1 parent f9d5de4 commit 4a14abc

2 files changed

Lines changed: 17 additions & 34 deletions

File tree

‎drivers/misc/cxl/cxl.h‎

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

909909
#ifdef CONFIG_DEBUG_FS
910910

911-
int cxl_debugfs_init(void);
911+
void cxl_debugfs_init(void);
912912
void cxl_debugfs_exit(void);
913-
int cxl_debugfs_adapter_add(struct cxl *adapter);
913+
void cxl_debugfs_adapter_add(struct cxl *adapter);
914914
void cxl_debugfs_adapter_remove(struct cxl *adapter);
915-
int cxl_debugfs_afu_add(struct cxl_afu *afu);
915+
void cxl_debugfs_afu_add(struct cxl_afu *afu);
916916
void cxl_debugfs_afu_remove(struct cxl_afu *afu);
917917
void cxl_debugfs_add_adapter_regs_psl9(struct cxl *adapter, struct dentry *dir);
918918
void cxl_debugfs_add_adapter_regs_psl8(struct cxl *adapter, struct dentry *dir);
@@ -921,27 +921,24 @@ void cxl_debugfs_add_afu_regs_psl8(struct cxl_afu *afu, struct dentry *dir);
921921

922922
#else /* CONFIG_DEBUG_FS */
923923

924-
static inline int __init cxl_debugfs_init(void)
924+
static inline void __init cxl_debugfs_init(void)
925925
{
926-
return 0;
927926
}
928927

929928
static inline void cxl_debugfs_exit(void)
930929
{
931930
}
932931

933-
static inline int cxl_debugfs_adapter_add(struct cxl *adapter)
932+
static inline void cxl_debugfs_adapter_add(struct cxl *adapter)
934933
{
935-
return 0;
936934
}
937935

938936
static inline void cxl_debugfs_adapter_remove(struct cxl *adapter)
939937
{
940938
}
941939

942-
static inline int cxl_debugfs_afu_add(struct cxl_afu *afu)
940+
static inline void cxl_debugfs_afu_add(struct cxl_afu *afu)
943941
{
944-
return 0;
945942
}
946943

947944
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
@@ -26,11 +26,11 @@ static int debugfs_io_u64_set(void *data, u64 val)
2626
DEFINE_DEBUGFS_ATTRIBUTE(fops_io_x64, debugfs_io_u64_get, debugfs_io_u64_set,
2727
"0x%016llx\n");
2828

29-
static struct dentry *debugfs_create_io_x64(const char *name, umode_t mode,
30-
struct dentry *parent, u64 __iomem *value)
29+
static void debugfs_create_io_x64(const char *name, umode_t mode,
30+
struct dentry *parent, u64 __iomem *value)
3131
{
32-
return debugfs_create_file_unsafe(name, mode, parent,
33-
(void __force *)value, &fops_io_x64);
32+
debugfs_create_file_unsafe(name, mode, parent, (void __force *)value,
33+
&fops_io_x64);
3434
}
3535

3636
void cxl_debugfs_add_adapter_regs_psl9(struct cxl *adapter, struct dentry *dir)
@@ -54,25 +54,22 @@ void cxl_debugfs_add_adapter_regs_psl8(struct cxl *adapter, struct dentry *dir)
5454
debugfs_create_io_x64("trace", S_IRUSR | S_IWUSR, dir, _cxl_p1_addr(adapter, CXL_PSL_TRACE));
5555
}
5656

57-
int cxl_debugfs_adapter_add(struct cxl *adapter)
57+
void cxl_debugfs_adapter_add(struct cxl *adapter)
5858
{
5959
struct dentry *dir;
6060
char buf[32];
6161

6262
if (!cxl_debugfs)
63-
return -ENODEV;
63+
return;
6464

6565
snprintf(buf, 32, "card%i", adapter->adapter_num);
6666
dir = debugfs_create_dir(buf, cxl_debugfs);
67-
if (IS_ERR(dir))
68-
return PTR_ERR(dir);
6967
adapter->debugfs = dir;
7068

7169
debugfs_create_io_x64("err_ivte", S_IRUSR, dir, _cxl_p1_addr(adapter, CXL_PSL_ErrIVTE));
7270

7371
if (adapter->native->sl_ops->debugfs_add_adapter_regs)
7472
adapter->native->sl_ops->debugfs_add_adapter_regs(adapter, dir);
75-
return 0;
7673
}
7774

7875
void cxl_debugfs_adapter_remove(struct cxl *adapter)
@@ -96,18 +93,16 @@ void cxl_debugfs_add_afu_regs_psl8(struct cxl_afu *afu, struct dentry *dir)
9693
debugfs_create_io_x64("trace", S_IRUSR | S_IWUSR, dir, _cxl_p1n_addr(afu, CXL_PSL_SLICE_TRACE));
9794
}
9895

99-
int cxl_debugfs_afu_add(struct cxl_afu *afu)
96+
void cxl_debugfs_afu_add(struct cxl_afu *afu)
10097
{
10198
struct dentry *dir;
10299
char buf[32];
103100

104101
if (!afu->adapter->debugfs)
105-
return -ENODEV;
102+
return;
106103

107104
snprintf(buf, 32, "psl%i.%i", afu->adapter->adapter_num, afu->slice);
108105
dir = debugfs_create_dir(buf, afu->adapter->debugfs);
109-
if (IS_ERR(dir))
110-
return PTR_ERR(dir);
111106
afu->debugfs = dir;
112107

113108
debugfs_create_io_x64("sr", S_IRUSR, dir, _cxl_p1n_addr(afu, CXL_PSL_SR_An));
@@ -118,28 +113,19 @@ int cxl_debugfs_afu_add(struct cxl_afu *afu)
118113

119114
if (afu->adapter->native->sl_ops->debugfs_add_afu_regs)
120115
afu->adapter->native->sl_ops->debugfs_add_afu_regs(afu, dir);
121-
122-
return 0;
123116
}
124117

125118
void cxl_debugfs_afu_remove(struct cxl_afu *afu)
126119
{
127120
debugfs_remove_recursive(afu->debugfs);
128121
}
129122

130-
int __init cxl_debugfs_init(void)
123+
void __init cxl_debugfs_init(void)
131124
{
132-
struct dentry *ent;
133-
134125
if (!cpu_has_feature(CPU_FTR_HVMODE))
135-
return 0;
136-
137-
ent = debugfs_create_dir("cxl", NULL);
138-
if (IS_ERR(ent))
139-
return PTR_ERR(ent);
140-
cxl_debugfs = ent;
126+
return;
141127

142-
return 0;
128+
cxl_debugfs = debugfs_create_dir("cxl", NULL);
143129
}
144130

145131
void cxl_debugfs_exit(void)

0 commit comments

Comments
 (0)