Skip to content

Commit

Permalink
---
Browse files Browse the repository at this point in the history
yaml
---
r: 189121
b: refs/heads/master
c: c519a5a
h: refs/heads/master
i:
  189119: 7b2fb55
v: v3
  • Loading branch information
Bjorn Helgaas authored and Jesse Barnes committed Mar 24, 2010
1 parent 4fd4c5e commit 38d0e0b
Show file tree
Hide file tree
Showing 2 changed files with 17 additions and 8 deletions.
2 changes: 1 addition & 1 deletion [refs]
Original file line number Diff line number Diff line change
@@ -1,2 +1,2 @@
---
refs/heads/master: e1944c6b0fba80a7837c1cbc47dfbf46e1274a4b
refs/heads/master: c519a5a7dab2d8e9a114f003e2d369bcf8e913f3
23 changes: 16 additions & 7 deletions trunk/drivers/pci/probe.c
Original file line number Diff line number Diff line change
Expand Up @@ -174,14 +174,19 @@ int __pci_read_base(struct pci_dev *dev, enum pci_bar_type type,
pci_read_config_dword(dev, pos, &sz);
pci_write_config_dword(dev, pos, l);

if (!sz)
goto fail; /* BAR not implemented */

/*
* All bits set in sz means the device isn't working properly.
* If the BAR isn't implemented, all bits must be 0. If it's a
* memory BAR or a ROM, bit 0 must be clear; if it's an io BAR, bit
* 1 must be clear.
* If it's a memory BAR or a ROM, bit 0 must be clear; if it's
* an io BAR, bit 1 must be clear.
*/
if (!sz || sz == 0xffffffff)
if (sz == 0xffffffff) {
dev_err(&dev->dev, "reg %x: invalid size %#x; broken device?\n",
pos, sz);
goto fail;
}

/*
* I don't know how l can have all bits set. Copied from old code.
Expand Down Expand Up @@ -244,13 +249,17 @@ int __pci_read_base(struct pci_dev *dev, enum pci_bar_type type,
pos, res);
}
} else {
sz = pci_size(l, sz, mask);
u32 size = pci_size(l, sz, mask);

if (!sz)
if (!size) {
dev_err(&dev->dev, "reg %x: invalid size "
"(l %#x sz %#x mask %#x); broken device?",
pos, l, sz, mask);
goto fail;
}

res->start = l;
res->end = l + sz;
res->end = l + size;

dev_printk(KERN_DEBUG, &dev->dev, "reg %x: %pR\n", pos, res);
}
Expand Down

0 comments on commit 38d0e0b

Please sign in to comment.