@@ -41,10 +41,9 @@ static int handle_ea_bar(u32 e0, int bar, struct pci_bus *bus,
41
41
}
42
42
if (where_a == 0x4 ) {
43
43
addr = bus -> ops -> map_bus (bus , devfn , bar ); /* BAR 0 */
44
- if (!addr ) {
45
- * val = ~0 ;
44
+ if (!addr )
46
45
return PCIBIOS_DEVICE_NOT_FOUND ;
47
- }
46
+
48
47
v = readl (addr );
49
48
v &= ~0xf ;
50
49
v |= 2 ; /* EA entry-1. Base-L */
@@ -56,10 +55,9 @@ static int handle_ea_bar(u32 e0, int bar, struct pci_bus *bus,
56
55
u32 barl_rb ;
57
56
58
57
addr = bus -> ops -> map_bus (bus , devfn , bar ); /* BAR 0 */
59
- if (!addr ) {
60
- * val = ~0 ;
58
+ if (!addr )
61
59
return PCIBIOS_DEVICE_NOT_FOUND ;
62
- }
60
+
63
61
barl_orig = readl (addr + 0 );
64
62
writel (0xffffffff , addr + 0 );
65
63
barl_rb = readl (addr + 0 );
@@ -72,10 +70,9 @@ static int handle_ea_bar(u32 e0, int bar, struct pci_bus *bus,
72
70
}
73
71
if (where_a == 0xc ) {
74
72
addr = bus -> ops -> map_bus (bus , devfn , bar + 4 ); /* BAR 1 */
75
- if (!addr ) {
76
- * val = ~0 ;
73
+ if (!addr )
77
74
return PCIBIOS_DEVICE_NOT_FOUND ;
78
- }
75
+
79
76
v = readl (addr ); /* EA entry-3. Base-H */
80
77
set_val (v , where , size , val );
81
78
return PCIBIOS_SUCCESSFUL ;
@@ -104,10 +101,8 @@ static int thunder_ecam_p2_config_read(struct pci_bus *bus, unsigned int devfn,
104
101
}
105
102
106
103
addr = bus -> ops -> map_bus (bus , devfn , where_a );
107
- if (!addr ) {
108
- * val = ~0 ;
104
+ if (!addr )
109
105
return PCIBIOS_DEVICE_NOT_FOUND ;
110
- }
111
106
112
107
v = readl (addr );
113
108
@@ -135,21 +130,17 @@ static int thunder_ecam_config_read(struct pci_bus *bus, unsigned int devfn,
135
130
int where_a = where & ~3 ;
136
131
137
132
addr = bus -> ops -> map_bus (bus , devfn , 0xc );
138
- if (!addr ) {
139
- * val = ~0 ;
133
+ if (!addr )
140
134
return PCIBIOS_DEVICE_NOT_FOUND ;
141
- }
142
135
143
136
v = readl (addr );
144
137
145
138
/* Check for non type-00 header */
146
139
cfg_type = (v >> 16 ) & 0x7f ;
147
140
148
141
addr = bus -> ops -> map_bus (bus , devfn , 8 );
149
- if (!addr ) {
150
- * val = ~0 ;
142
+ if (!addr )
151
143
return PCIBIOS_DEVICE_NOT_FOUND ;
152
- }
153
144
154
145
class_rev = readl (addr );
155
146
if (class_rev == 0xffffffff )
@@ -176,10 +167,8 @@ static int thunder_ecam_config_read(struct pci_bus *bus, unsigned int devfn,
176
167
}
177
168
178
169
addr = bus -> ops -> map_bus (bus , devfn , 0 );
179
- if (!addr ) {
180
- * val = ~0 ;
170
+ if (!addr )
181
171
return PCIBIOS_DEVICE_NOT_FOUND ;
182
- }
183
172
184
173
vendor_device = readl (addr );
185
174
if (vendor_device == 0xffffffff )
@@ -196,10 +185,9 @@ static int thunder_ecam_config_read(struct pci_bus *bus, unsigned int devfn,
196
185
bool is_tns = (vendor_device == 0xa01f177d );
197
186
198
187
addr = bus -> ops -> map_bus (bus , devfn , 0x70 );
199
- if (!addr ) {
200
- * val = ~0 ;
188
+ if (!addr )
201
189
return PCIBIOS_DEVICE_NOT_FOUND ;
202
- }
190
+
203
191
/* E_CAP */
204
192
v = readl (addr );
205
193
has_msix = (v & 0xff00 ) != 0 ;
@@ -211,10 +199,9 @@ static int thunder_ecam_config_read(struct pci_bus *bus, unsigned int devfn,
211
199
}
212
200
if (where_a == 0xb0 ) {
213
201
addr = bus -> ops -> map_bus (bus , devfn , where_a );
214
- if (!addr ) {
215
- * val = ~0 ;
202
+ if (!addr )
216
203
return PCIBIOS_DEVICE_NOT_FOUND ;
217
- }
204
+
218
205
v = readl (addr );
219
206
if (v & 0xff00 )
220
207
pr_err ("Bad MSIX cap header: %08x\n" , v );
@@ -268,10 +255,9 @@ static int thunder_ecam_config_read(struct pci_bus *bus, unsigned int devfn,
268
255
269
256
if (where_a == 0x70 ) {
270
257
addr = bus -> ops -> map_bus (bus , devfn , where_a );
271
- if (!addr ) {
272
- * val = ~0 ;
258
+ if (!addr )
273
259
return PCIBIOS_DEVICE_NOT_FOUND ;
274
- }
260
+
275
261
v = readl (addr );
276
262
if (v & 0xff00 )
277
263
pr_err ("Bad PCIe cap header: %08x\n" , v );
0 commit comments