Commit cc9bd99e9adfa4f44ea050a63fb41a3f764acf84

Authored by Al Viro
Committed by Linus Torvalds
1 parent a83fbf6359

[PATCH] fix ancient breakage in ebus_init()

Back when pci_dev had base_address[], loop of form
	base = &...->base_address[0];
	for (.....) {
		...
		*base++ = addr;
	}
was fine, but when that array got spread in ->resource[...].start
replacing the initialization with
	base = &...->resource[0].start;
was not a sufficient modification.  IOW this code got broken for cases
when there had been more than one resource to fill.  All way back in
2.3.41-pre3...

Signed-off-by: Al Viro <viro@zeniv.linux.org.uk>
Signed-off-by: Linus Torvalds <torvalds@osdl.org>

Showing 1 changed file with 3 additions and 4 deletions Side-by-side Diff

arch/sparc/kernel/ebus.c
... ... @@ -277,7 +277,7 @@
277 277 struct pci_dev *pdev;
278 278 struct pcidev_cookie *cookie;
279 279 struct device_node *dp;
280   - unsigned long addr, *base;
  280 + struct resource *p;
281 281 unsigned short pci_command;
282 282 int len, reg, nreg;
283 283 int num_ebus = 0;
284 284  
... ... @@ -321,13 +321,12 @@
321 321 }
322 322 nreg = len / sizeof(struct linux_prom_pci_registers);
323 323  
324   - base = &ebus->self->resource[0].start;
  324 + p = &ebus->self->resource[0];
325 325 for (reg = 0; reg < nreg; reg++) {
326 326 if (!(regs[reg].which_io & 0x03000000))
327 327 continue;
328 328  
329   - addr = regs[reg].phys_lo;
330   - *base++ = addr;
  329 + (p++)->start = regs[reg].phys_lo;
331 330 }
332 331  
333 332 ebus->ofdev.node = dp;