aboutsummaryrefslogtreecommitdiffstats
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)
274 274
275 rc = pci_request_region(pdev, i, name); 275 rc = pci_request_region(pdev, i, name);
276 if (rc) 276 if (rc)
277 goto err_region; 277 goto err_inval;
278 278
279 rc = -ENOMEM; 279 rc = -ENOMEM;
280 if (!pcim_iomap(pdev, i, 0)) 280 if (!pcim_iomap(pdev, i, 0))
281 goto err_iomap; 281 goto err_region;
282 } 282 }
283 283
284 return 0; 284 return 0;
285 285
286 err_iomap:
287 pcim_iounmap(pdev, iomap[i]);
288 err_region: 286 err_region:
289 pci_release_region(pdev, i); 287 pci_release_region(pdev, i);
290 err_inval: 288 err_inval:
291 while (--i >= 0) { 289 while (--i >= 0) {
290 if (!(mask & (1 << i)))
291 continue;
292 pcim_iounmap(pdev, iomap[i]); 292 pcim_iounmap(pdev, iomap[i]);
293 pci_release_region(pdev, i); 293 pci_release_region(pdev, i);
294 } 294 }