diff options
author | Rodrigo Vivi <rodrigo.vivi@intel.com> | 2017-12-08 21:15:30 +0300 |
---|---|---|
committer | Rodrigo Vivi <rodrigo.vivi@intel.com> | 2017-12-08 21:15:30 +0300 |
commit | 6647852abc1fd74e9c5e0dcf404ea4cb9c929630 (patch) | |
tree | 371aa801a5a211f5f8af87bd5488e3dae75ea975 /drivers/pci/rom.c | |
parent | 3e72be177cf19ab3d62b3084d424dce7e71d847f (diff) | |
parent | 3f1f0b1c57dd617e9b0ded50efb8d6c011b85b20 (diff) | |
download | linux-6647852abc1fd74e9c5e0dcf404ea4cb9c929630.tar.xz |
Merge airlied/drm-next into drm-intel-next-queued
Chris requested this backmerge for a reconciliation on
drm_print.h between drm-misc-next and drm-intel-next-queued
Signed-off-by: Rodrigo Vivi <rodrigo.vivi@intel.com>
Diffstat (limited to 'drivers/pci/rom.c')
-rw-r--r-- | drivers/pci/rom.c | 19 |
1 files changed, 13 insertions, 6 deletions
diff --git a/drivers/pci/rom.c b/drivers/pci/rom.c index b6edb187d160..1f5e6af96c83 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 @@ -160,7 +156,18 @@ void __iomem *pci_map_rom(struct pci_dev *pdev, size_t *size) * True size is important if the ROM is going to be copied. */ *size = pci_get_rom_size(pdev, rom, *size); + if (!*size) + goto invalid_rom; + return rom; + +invalid_rom: + iounmap(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); |