summaryrefslogtreecommitdiffstats
path: root/drivers/pci/rom.c
diff options
context:
space:
mode:
authorBjorn Helgaas <bhelgaas@google.com>2014-02-26 11:25:58 -0700
committerBjorn Helgaas <bhelgaas@google.com>2014-02-27 10:43:32 -0700
commitbd064f0a231af336218838474ea45a64f1672190 (patch)
treea1deda3444f1c2554e22c6969641352cc2cc8eb1 /drivers/pci/rom.c
parentf44116ae881868ab72274df1eff48fdbde9898af (diff)
downloadlinux-bd064f0a231af336218838474ea45a64f1672190.tar.gz
linux-bd064f0a231af336218838474ea45a64f1672190.tar.bz2
linux-bd064f0a231af336218838474ea45a64f1672190.zip
PCI: Mark resources as IORESOURCE_UNSET if we can't assign them
When assigning addresses to resources, mark them with IORESOURCE_UNSET before we start and clear IORESOURCE_UNSET if assignment is successful. That means that if we print the resource during assignment, we will show the size, not a meaningless address. Also, clear IORESOURCE_UNSET if we do assign an address, so we print the address when it is valid. Signed-off-by: Bjorn Helgaas <bhelgaas@google.com>
Diffstat (limited to 'drivers/pci/rom.c')
-rw-r--r--drivers/pci/rom.c2
1 files changed, 2 insertions, 0 deletions
diff --git a/drivers/pci/rom.c b/drivers/pci/rom.c
index 5d595724e5f4..c1839450d4d6 100644
--- a/drivers/pci/rom.c
+++ b/drivers/pci/rom.c
@@ -197,8 +197,10 @@ void pci_unmap_rom(struct pci_dev *pdev, void __iomem *rom)
void pci_cleanup_rom(struct pci_dev *pdev)
{
struct resource *res = &pdev->resource[PCI_ROM_RESOURCE];
+
if (res->flags & IORESOURCE_ROM_COPY) {
kfree((void*)(unsigned long)res->start);
+ res->flags |= IORESOURCE_UNSET;
res->flags &= ~IORESOURCE_ROM_COPY;
res->start = 0;
res->end = 0;