diff options
Diffstat (limited to 'drivers/char/mxser_new.c')
-rw-r--r-- | drivers/char/mxser_new.c | 21 |
1 files changed, 17 insertions, 4 deletions
diff --git a/drivers/char/mxser_new.c b/drivers/char/mxser_new.c index 4db43f31b693..5a4c80d38c65 100644 --- a/drivers/char/mxser_new.c +++ b/drivers/char/mxser_new.c | |||
@@ -622,19 +622,24 @@ static int __init mxser_get_PCI_conf(int board_type, struct mxser_board *brd, | |||
622 | { | 622 | { |
623 | unsigned int i, j; | 623 | unsigned int i, j; |
624 | unsigned long ioaddress; | 624 | unsigned long ioaddress; |
625 | int retval; | ||
625 | 626 | ||
626 | /* io address */ | 627 | /* io address */ |
627 | brd->board_type = board_type; | 628 | brd->board_type = board_type; |
628 | brd->nports = mxser_numports[board_type - 1]; | 629 | brd->nports = mxser_numports[board_type - 1]; |
629 | ioaddress = pci_resource_start(pdev, 2); | 630 | ioaddress = pci_resource_start(pdev, 2); |
630 | pci_request_region(pdev, 2, "mxser(IO)"); | 631 | retval = pci_request_region(pdev, 2, "mxser(IO)"); |
632 | if (retval) | ||
633 | goto err; | ||
631 | 634 | ||
632 | for (i = 0; i < brd->nports; i++) | 635 | for (i = 0; i < brd->nports; i++) |
633 | brd->ports[i].ioaddr = ioaddress + 8 * i; | 636 | brd->ports[i].ioaddr = ioaddress + 8 * i; |
634 | 637 | ||
635 | /* vector */ | 638 | /* vector */ |
636 | ioaddress = pci_resource_start(pdev, 3); | 639 | ioaddress = pci_resource_start(pdev, 3); |
637 | pci_request_region(pdev, 3, "mxser(vector)"); | 640 | retval = pci_request_region(pdev, 3, "mxser(vector)"); |
641 | if (retval) | ||
642 | goto err_relio; | ||
638 | brd->vector = ioaddress; | 643 | brd->vector = ioaddress; |
639 | 644 | ||
640 | /* irq */ | 645 | /* irq */ |
@@ -674,6 +679,10 @@ static int __init mxser_get_PCI_conf(int board_type, struct mxser_board *brd, | |||
674 | brd->ports[i].baud_base = 921600; | 679 | brd->ports[i].baud_base = 921600; |
675 | } | 680 | } |
676 | return 0; | 681 | return 0; |
682 | err_relio: | ||
683 | pci_release_region(pdev, 2); | ||
684 | err: | ||
685 | return retval; | ||
677 | } | 686 | } |
678 | 687 | ||
679 | static int __init mxser_init(void) | 688 | static int __init mxser_init(void) |
@@ -3009,8 +3018,12 @@ static int __init mxser_get_ISA_conf(int cap, struct mxser_board *brd) | |||
3009 | brd->nports = 8; | 3018 | brd->nports = 8; |
3010 | else | 3019 | else |
3011 | brd->nports = 4; | 3020 | brd->nports = 4; |
3012 | request_region(brd->ports[0].ioaddr, 8 * brd->nports, "mxser(IO)"); | 3021 | if (!request_region(brd->ports[0].ioaddr, 8 * brd->nports, "mxser(IO)")) |
3013 | request_region(brd->vector, 1, "mxser(vector)"); | 3022 | return MXSER_ERR_IOADDR; |
3023 | if (!request_region(brd->vector, 1, "mxser(vector)")) { | ||
3024 | release_region(brd->ports[0].ioaddr, 8 * brd->nports); | ||
3025 | return MXSER_ERR_VECTOR; | ||
3026 | } | ||
3014 | return brd->nports; | 3027 | return brd->nports; |
3015 | } | 3028 | } |
3016 | 3029 | ||