aboutsummaryrefslogtreecommitdiffstats
path: root/src/pciinit.c
diff options
context:
space:
mode:
authorKevin O'Connor <kevin@koconnor.net>2009-11-09 19:15:08 -0500
committerKevin O'Connor <kevin@koconnor.net>2009-11-09 19:15:08 -0500
commit9dbc2ad0b82c8a9fd5f68cc1b5b880bf9a0ddaa4 (patch)
treedbd2bc476dc2ac73d778a57d68429a6dec93495b /src/pciinit.c
parent9eebe66a9978165cfa91f2266c97fa5d0aa6ef2e (diff)
downloadseabios-9dbc2ad0b82c8a9fd5f68cc1b5b880bf9a0ddaa4.tar.gz
Fix typo in pci_bios_init_device() causing use before set error.
The 'val' variable is used before being set - 'old' was intended.
Diffstat (limited to 'src/pciinit.c')
-rw-r--r--src/pciinit.c10
1 files changed, 5 insertions, 5 deletions
diff --git a/src/pciinit.c b/src/pciinit.c
index 39c8f0fa..fe7575c6 100644
--- a/src/pciinit.c
+++ b/src/pciinit.c
@@ -126,28 +126,28 @@ static void pci_bios_init_device(u16 bdf)
/* default memory mappings */
for (i = 0; i < PCI_NUM_REGIONS; i++) {
int ofs;
- u32 old, val, mask, size;
if (i == PCI_ROM_SLOT)
ofs = PCI_ROM_ADDRESS;
else
ofs = PCI_BASE_ADDRESS_0 + i * 4;
- old = pci_config_readl(bdf, ofs);
+ u32 old = pci_config_readl(bdf, ofs);
+ u32 mask;
if (i == PCI_ROM_SLOT) {
mask = PCI_ROM_ADDRESS_MASK;
pci_config_writel(bdf, ofs, mask);
} else {
- if (val & PCI_BASE_ADDRESS_SPACE_IO)
+ if (old & PCI_BASE_ADDRESS_SPACE_IO)
mask = PCI_BASE_ADDRESS_IO_MASK;
else
mask = PCI_BASE_ADDRESS_MEM_MASK;
pci_config_writel(bdf, ofs, ~0);
}
- val = pci_config_readl(bdf, ofs);
+ u32 val = pci_config_readl(bdf, ofs);
pci_config_writel(bdf, ofs, old);
if (val != 0) {
- size = (~(val & mask)) + 1;
+ u32 size = (~(val & mask)) + 1;
if (val & PCI_BASE_ADDRESS_SPACE_IO)
paddr = &pci_bios_io_addr;
else if (size >= 0x04000000)