aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorRex Zhu <Rex.Zhu@amd.com>2018-06-04 21:46:46 -0400
committerBjorn Helgaas <bhelgaas@google.com>2018-06-29 22:16:23 -0400
commitbeced88e6af43c9653cee09f5111ae7495824e07 (patch)
tree26075954aeafea92c7c2dda3845b1ba2709e8bda
parent445ec321e71b3124abacfb358f72ac6a70d87602 (diff)
PCI: Add check code for last image indicator not set
If the "last image" indicator was not set in the PCI data struct, print "No more image in the PCI ROM" instead of looping back and printing "Invalid PCI ROM header signature". Signed-off-by: Rex Zhu <Rex.Zhu@amd.com> Signed-off-by: Bjorn Helgaas <bhelgaas@google.com> Reviewed-by: Alex Deucher <alexander.deucher@amd.com>
-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)
108 /* Avoid iterating through memory outside the resource window */ 108 /* Avoid iterating through memory outside the resource window */
109 if (image >= rom + size) 109 if (image >= rom + size)
110 break; 110 break;
111 if (!last_image) {
112 if (readw(image) != 0xAA55) {
113 pci_info(pdev, "No more image in the PCI ROM\n");
114 break;
115 }
116 }
111 } while (length && !last_image); 117 } while (length && !last_image);
112 118
113 /* never return a size larger than the PCI resource window */ 119 /* never return a size larger than the PCI resource window */