summaryrefslogtreecommitdiffstats
path: root/drivers/pci/rom.c
diff options
context:
space:
mode:
Diffstat (limited to 'drivers/pci/rom.c')
-rw-r--r--drivers/pci/rom.c6
1 files changed, 6 insertions, 0 deletions
diff --git a/drivers/pci/rom.c b/drivers/pci/rom.c
index 946795fc0071..3a33f5ce314a 100644
--- a/drivers/pci/rom.c
+++ b/drivers/pci/rom.c
@@ -108,6 +108,12 @@ size_t pci_get_rom_size(struct pci_dev *pdev, void __iomem *rom, size_t size)
/* Avoid iterating through memory outside the resource window */
if (image >= rom + size)
break;
+ if (!last_image) {
+ if (readw(image) != 0xAA55) {
+ pci_info(pdev, "No more image in the PCI ROM\n");
+ break;
+ }
+ }
} while (length && !last_image);
/* never return a size larger than the PCI resource window */