Skip to content

Commit

Permalink
[PATCH] pci_iomap_regions() error handling fix
Browse files Browse the repository at this point in the history
It appears that the pcim_iomap_regions() function doesn't get the error
handling right. It BUGs early at boot with a backtrace along the lines of:

ahci_init
pci_register_driver
driver_register
[...]
ahci_init_one
pcim_iomap_region
pcim_iounmap

The following patch allows me to boot. Only the if(mask..) continue;
part fixes the problem actually, the gotos where changed so that we
don't try to unmap something we couldn't map anyway.

Signed-off-by: Frederik Deweerdt <[email protected]>
Cc: Al Viro <[email protected]>
Cc: Tejun Heo <[email protected]>
Cc: Jeff Garzik <[email protected]>
Signed-off-by: Andrew Morton <[email protected]>
Signed-off-by: Linus Torvalds <[email protected]>
  • Loading branch information
Frederik Deweerdt authored and Linus Torvalds committed Feb 16, 2007
1 parent f5de611 commit fb4d64e
Showing 1 changed file with 4 additions and 4 deletions.
8 changes: 4 additions & 4 deletions lib/devres.c
Original file line number Diff line number Diff line change
Expand Up @@ -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);
}
Expand Down

0 comments on commit fb4d64e

Please sign in to comment.