]> asedeno.scripts.mit.edu Git - linux.git/commitdiff
PCI: Move pci_map_rom() error path
authorChangbin Du <changbin.du@intel.com>
Wed, 8 Nov 2017 00:22:26 +0000 (18:22 -0600)
committerBjorn Helgaas <bhelgaas@google.com>
Wed, 8 Nov 2017 20:47:06 +0000 (14:47 -0600)
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>
drivers/pci/rom.c

index b6edb187d160c6dda3fb4bbccb5b0b85877ec4f5..0decf0d81cf589c0b142aef74ff3a6aac865fc9c 100644 (file)
@@ -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);