summaryrefslogtreecommitdiff
path: root/drivers/pci/rom.c
diff options
context:
space:
mode:
authorChangbin Du <changbin.du@intel.com>2017-11-08 03:22:26 +0300
committerBjorn Helgaas <bhelgaas@google.com>2017-11-08 23:47:06 +0300
commita48a687d8cdf9a51a6283cc91f9637403b221ed3 (patch)
tree9294785347a423b2f82ff21ede4a9d5e24c03a0a /drivers/pci/rom.c
parentfa564ad9636651fd11ec2c79c48dee844066f73a (diff)
downloadlinux-a48a687d8cdf9a51a6283cc91f9637403b221ed3.tar.xz
PCI: Move pci_map_rom() error path
Move pci_map_rom() error code to the end to prepare for adding another error path. No functional change intended. Signed-off-by: Changbin Du <changbin.du@intel.com> [bhelgaas: split non-functional change into separate patch] Signed-off-by: Bjorn Helgaas <bhelgaas@google.com>
Diffstat (limited to 'drivers/pci/rom.c')
-rw-r--r--drivers/pci/rom.c14
1 files changed, 8 insertions, 6 deletions
diff --git a/drivers/pci/rom.c b/drivers/pci/rom.c
index b6edb187d160..0decf0d81cf5 100644
--- a/drivers/pci/rom.c
+++ b/drivers/pci/rom.c
@@ -147,12 +147,8 @@ void __iomem *pci_map_rom(struct pci_dev *pdev, size_t *size)
return NULL;
rom = ioremap(start, *size);
- if (!rom) {
- /* restore enable if ioremap fails */
- if (!(res->flags & IORESOURCE_ROM_ENABLE))
- pci_disable_rom(pdev);
- return NULL;
- }
+ if (!rom)
+ goto err_ioremap;
/*
* Try to find the true size of the ROM since sometimes the PCI window
@@ -161,6 +157,12 @@ void __iomem *pci_map_rom(struct pci_dev *pdev, size_t *size)
*/
*size = pci_get_rom_size(pdev, rom, *size);
return rom;
+
+err_ioremap:
+ /* restore enable if ioremap fails */
+ if (!(res->flags & IORESOURCE_ROM_ENABLE))
+ pci_disable_rom(pdev);
+ return NULL;
}
EXPORT_SYMBOL(pci_map_rom);