diff options
Diffstat (limited to 'drivers/pci/probe.c')
| -rw-r--r-- | drivers/pci/probe.c | 23 |
1 files changed, 7 insertions, 16 deletions
diff --git a/drivers/pci/probe.c b/drivers/pci/probe.c index 882bd8d29fe3..c82548afcd5c 100644 --- a/drivers/pci/probe.c +++ b/drivers/pci/probe.c | |||
| @@ -174,19 +174,14 @@ int __pci_read_base(struct pci_dev *dev, enum pci_bar_type type, | |||
| 174 | pci_read_config_dword(dev, pos, &sz); | 174 | pci_read_config_dword(dev, pos, &sz); |
| 175 | pci_write_config_dword(dev, pos, l); | 175 | pci_write_config_dword(dev, pos, l); |
| 176 | 176 | ||
| 177 | if (!sz) | ||
| 178 | goto fail; /* BAR not implemented */ | ||
| 179 | |||
| 180 | /* | 177 | /* |
| 181 | * All bits set in sz means the device isn't working properly. | 178 | * All bits set in sz means the device isn't working properly. |
| 182 | * If it's a memory BAR or a ROM, bit 0 must be clear; if it's | 179 | * If the BAR isn't implemented, all bits must be 0. If it's a |
| 183 | * an io BAR, bit 1 must be clear. | 180 | * memory BAR or a ROM, bit 0 must be clear; if it's an io BAR, bit |
| 181 | * 1 must be clear. | ||
| 184 | */ | 182 | */ |
| 185 | if (sz == 0xffffffff) { | 183 | if (!sz || sz == 0xffffffff) |
| 186 | dev_err(&dev->dev, "reg %x: invalid size %#x; broken device?\n", | ||
| 187 | pos, sz); | ||
| 188 | goto fail; | 184 | goto fail; |
| 189 | } | ||
| 190 | 185 | ||
| 191 | /* | 186 | /* |
| 192 | * I don't know how l can have all bits set. Copied from old code. | 187 | * I don't know how l can have all bits set. Copied from old code. |
| @@ -249,17 +244,13 @@ int __pci_read_base(struct pci_dev *dev, enum pci_bar_type type, | |||
| 249 | pos, res); | 244 | pos, res); |
| 250 | } | 245 | } |
| 251 | } else { | 246 | } else { |
| 252 | u32 size = pci_size(l, sz, mask); | 247 | sz = pci_size(l, sz, mask); |
| 253 | 248 | ||
| 254 | if (!size) { | 249 | if (!sz) |
| 255 | dev_err(&dev->dev, "reg %x: invalid size " | ||
| 256 | "(l %#x sz %#x mask %#x); broken device?", | ||
| 257 | pos, l, sz, mask); | ||
| 258 | goto fail; | 250 | goto fail; |
| 259 | } | ||
| 260 | 251 | ||
| 261 | res->start = l; | 252 | res->start = l; |
| 262 | res->end = l + size; | 253 | res->end = l + sz; |
| 263 | 254 | ||
| 264 | dev_printk(KERN_DEBUG, &dev->dev, "reg %x: %pR\n", pos, res); | 255 | dev_printk(KERN_DEBUG, &dev->dev, "reg %x: %pR\n", pos, res); |
| 265 | } | 256 | } |
