aboutsummaryrefslogtreecommitdiff
path: root/lib/devres.c
diff options
context:
space:
mode:
Diffstat (limited to 'lib/devres.c')
-rw-r--r--lib/devres.c8
1 files changed, 4 insertions, 4 deletions
diff --git a/lib/devres.c b/lib/devres.c
index 2a668dd7cac7..eb38849aa717 100644
--- a/lib/devres.c
+++ b/lib/devres.c
@@ -274,21 +274,21 @@ int pcim_iomap_regions(struct pci_dev *pdev, u16 mask, const char *name)
rc = pci_request_region(pdev, i, name);
if (rc)
- goto err_region;
+ goto err_inval;
rc = -ENOMEM;
if (!pcim_iomap(pdev, i, 0))
- goto err_iomap;
+ goto err_region;
}
return 0;
- err_iomap:
- pcim_iounmap(pdev, iomap[i]);
err_region:
pci_release_region(pdev, i);
err_inval:
while (--i >= 0) {
+ if (!(mask & (1 << i)))
+ continue;
pcim_iounmap(pdev, iomap[i]);
pci_release_region(pdev, i);
}