summaryrefslogtreecommitdiffstats
path: root/drivers/misc
diff options
context:
space:
mode:
authorGreg Kroah-Hartman <gregkh@linuxfoundation.org>2019-06-12 11:54:18 -0400
committerMichael Ellerman <mpe@ellerman.id.au>2019-06-19 06:05:08 -0400
commit1b7de1df997a57e3e144bdb31ceaee9c16d6d284 (patch)
tree6deaebc99dd7161343e37d966fb30316c1433a83 /drivers/misc
parent0b1be03f25bb4c92de6408da4de9361f4cb50ae3 (diff)
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 <gregkh@linuxfoundation.org> Reviewed-by: Arnd Bergmann <arnd@arndb.de> Reviewed-by: Frederic Barrat <fbarrat@linux.ibm.com> Acked-by: Andrew Donnellan <ajd@linux.ibm.com> Signed-off-by: Michael Ellerman <mpe@ellerman.id.au>
Diffstat (limited to 'drivers/misc')
-rw-r--r--drivers/misc/cxl/cxl.h15
-rw-r--r--drivers/misc/cxl/debugfs.c36
2 files changed, 17 insertions, 34 deletions
diff --git a/drivers/misc/cxl/cxl.h b/drivers/misc/cxl/cxl.h
index d1d927ccb589..1e3e1ee68395 100644
--- a/drivers/misc/cxl/cxl.h
+++ b/drivers/misc/cxl/cxl.h
@@ -912,11 +912,11 @@ void cxl_update_dedicated_ivtes_psl8(struct cxl_context *ctx);
912 912
913#ifdef CONFIG_DEBUG_FS 913#ifdef CONFIG_DEBUG_FS
914 914
915int cxl_debugfs_init(void); 915void cxl_debugfs_init(void);
916void cxl_debugfs_exit(void); 916void cxl_debugfs_exit(void);
917int cxl_debugfs_adapter_add(struct cxl *adapter); 917void cxl_debugfs_adapter_add(struct cxl *adapter);
918void cxl_debugfs_adapter_remove(struct cxl *adapter); 918void cxl_debugfs_adapter_remove(struct cxl *adapter);
919int cxl_debugfs_afu_add(struct cxl_afu *afu); 919void cxl_debugfs_afu_add(struct cxl_afu *afu);
920void cxl_debugfs_afu_remove(struct cxl_afu *afu); 920void cxl_debugfs_afu_remove(struct cxl_afu *afu);
921void cxl_debugfs_add_adapter_regs_psl9(struct cxl *adapter, struct dentry *dir); 921void cxl_debugfs_add_adapter_regs_psl9(struct cxl *adapter, struct dentry *dir);
922void cxl_debugfs_add_adapter_regs_psl8(struct cxl *adapter, struct dentry *dir); 922void 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);
925 925
926#else /* CONFIG_DEBUG_FS */ 926#else /* CONFIG_DEBUG_FS */
927 927
928static inline int __init cxl_debugfs_init(void) 928static inline void __init cxl_debugfs_init(void)
929{ 929{
930 return 0;
931} 930}
932 931
933static inline void cxl_debugfs_exit(void) 932static inline void cxl_debugfs_exit(void)
934{ 933{
935} 934}
936 935
937static inline int cxl_debugfs_adapter_add(struct cxl *adapter) 936static inline void cxl_debugfs_adapter_add(struct cxl *adapter)
938{ 937{
939 return 0;
940} 938}
941 939
942static inline void cxl_debugfs_adapter_remove(struct cxl *adapter) 940static inline void cxl_debugfs_adapter_remove(struct cxl *adapter)
943{ 941{
944} 942}
945 943
946static inline int cxl_debugfs_afu_add(struct cxl_afu *afu) 944static inline void cxl_debugfs_afu_add(struct cxl_afu *afu)
947{ 945{
948 return 0;
949} 946}
950 947
951static inline void cxl_debugfs_afu_remove(struct cxl_afu *afu) 948static inline void cxl_debugfs_afu_remove(struct cxl_afu *afu)
diff --git a/drivers/misc/cxl/debugfs.c b/drivers/misc/cxl/debugfs.c
index a1921d81593a..e199a8021ab9 100644
--- a/drivers/misc/cxl/debugfs.c
+++ b/drivers/misc/cxl/debugfs.c
@@ -30,11 +30,11 @@ static int debugfs_io_u64_set(void *data, u64 val)
30DEFINE_DEBUGFS_ATTRIBUTE(fops_io_x64, debugfs_io_u64_get, debugfs_io_u64_set, 30DEFINE_DEBUGFS_ATTRIBUTE(fops_io_x64, debugfs_io_u64_get, debugfs_io_u64_set,
31 "0x%016llx\n"); 31 "0x%016llx\n");
32 32
33static struct dentry *debugfs_create_io_x64(const char *name, umode_t mode, 33static void debugfs_create_io_x64(const char *name, umode_t mode,
34 struct dentry *parent, u64 __iomem *value) 34 struct dentry *parent, u64 __iomem *value)
35{ 35{
36 return debugfs_create_file_unsafe(name, mode, parent, 36 debugfs_create_file_unsafe(name, mode, parent, (void __force *)value,
37 (void __force *)value, &fops_io_x64); 37 &fops_io_x64);
38} 38}
39 39
40void cxl_debugfs_add_adapter_regs_psl9(struct cxl *adapter, struct dentry *dir) 40void 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)
58 debugfs_create_io_x64("trace", S_IRUSR | S_IWUSR, dir, _cxl_p1_addr(adapter, CXL_PSL_TRACE)); 58 debugfs_create_io_x64("trace", S_IRUSR | S_IWUSR, dir, _cxl_p1_addr(adapter, CXL_PSL_TRACE));
59} 59}
60 60
61int cxl_debugfs_adapter_add(struct cxl *adapter) 61void cxl_debugfs_adapter_add(struct cxl *adapter)
62{ 62{
63 struct dentry *dir; 63 struct dentry *dir;
64 char buf[32]; 64 char buf[32];
65 65
66 if (!cxl_debugfs) 66 if (!cxl_debugfs)
67 return -ENODEV; 67 return;
68 68
69 snprintf(buf, 32, "card%i", adapter->adapter_num); 69 snprintf(buf, 32, "card%i", adapter->adapter_num);
70 dir = debugfs_create_dir(buf, cxl_debugfs); 70 dir = debugfs_create_dir(buf, cxl_debugfs);
71 if (IS_ERR(dir))
72 return PTR_ERR(dir);
73 adapter->debugfs = dir; 71 adapter->debugfs = dir;
74 72
75 debugfs_create_io_x64("err_ivte", S_IRUSR, dir, _cxl_p1_addr(adapter, CXL_PSL_ErrIVTE)); 73 debugfs_create_io_x64("err_ivte", S_IRUSR, dir, _cxl_p1_addr(adapter, CXL_PSL_ErrIVTE));
76 74
77 if (adapter->native->sl_ops->debugfs_add_adapter_regs) 75 if (adapter->native->sl_ops->debugfs_add_adapter_regs)
78 adapter->native->sl_ops->debugfs_add_adapter_regs(adapter, dir); 76 adapter->native->sl_ops->debugfs_add_adapter_regs(adapter, dir);
79 return 0;
80} 77}
81 78
82void cxl_debugfs_adapter_remove(struct cxl *adapter) 79void 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)
100 debugfs_create_io_x64("trace", S_IRUSR | S_IWUSR, dir, _cxl_p1n_addr(afu, CXL_PSL_SLICE_TRACE)); 97 debugfs_create_io_x64("trace", S_IRUSR | S_IWUSR, dir, _cxl_p1n_addr(afu, CXL_PSL_SLICE_TRACE));
101} 98}
102 99
103int cxl_debugfs_afu_add(struct cxl_afu *afu) 100void cxl_debugfs_afu_add(struct cxl_afu *afu)
104{ 101{
105 struct dentry *dir; 102 struct dentry *dir;
106 char buf[32]; 103 char buf[32];
107 104
108 if (!afu->adapter->debugfs) 105 if (!afu->adapter->debugfs)
109 return -ENODEV; 106 return;
110 107
111 snprintf(buf, 32, "psl%i.%i", afu->adapter->adapter_num, afu->slice); 108 snprintf(buf, 32, "psl%i.%i", afu->adapter->adapter_num, afu->slice);
112 dir = debugfs_create_dir(buf, afu->adapter->debugfs); 109 dir = debugfs_create_dir(buf, afu->adapter->debugfs);
113 if (IS_ERR(dir))
114 return PTR_ERR(dir);
115 afu->debugfs = dir; 110 afu->debugfs = dir;
116 111
117 debugfs_create_io_x64("sr", S_IRUSR, dir, _cxl_p1n_addr(afu, CXL_PSL_SR_An)); 112 debugfs_create_io_x64("sr", S_IRUSR, dir, _cxl_p1n_addr(afu, CXL_PSL_SR_An));
@@ -122,8 +117,6 @@ int cxl_debugfs_afu_add(struct cxl_afu *afu)
122 117
123 if (afu->adapter->native->sl_ops->debugfs_add_afu_regs) 118 if (afu->adapter->native->sl_ops->debugfs_add_afu_regs)
124 afu->adapter->native->sl_ops->debugfs_add_afu_regs(afu, dir); 119 afu->adapter->native->sl_ops->debugfs_add_afu_regs(afu, dir);
125
126 return 0;
127} 120}
128 121
129void cxl_debugfs_afu_remove(struct cxl_afu *afu) 122void cxl_debugfs_afu_remove(struct cxl_afu *afu)
@@ -131,19 +124,12 @@ void cxl_debugfs_afu_remove(struct cxl_afu *afu)
131 debugfs_remove_recursive(afu->debugfs); 124 debugfs_remove_recursive(afu->debugfs);
132} 125}
133 126
134int __init cxl_debugfs_init(void) 127void __init cxl_debugfs_init(void)
135{ 128{
136 struct dentry *ent;
137
138 if (!cpu_has_feature(CPU_FTR_HVMODE)) 129 if (!cpu_has_feature(CPU_FTR_HVMODE))
139 return 0; 130 return;
140
141 ent = debugfs_create_dir("cxl", NULL);
142 if (IS_ERR(ent))
143 return PTR_ERR(ent);
144 cxl_debugfs = ent;
145 131
146 return 0; 132 cxl_debugfs = debugfs_create_dir("cxl", NULL);
147} 133}
148 134
149void cxl_debugfs_exit(void) 135void cxl_debugfs_exit(void)