]> git.hungrycats.org Git - linux/commitdiff
[PATCH] small region change for boardergo.c
authorWilliam Stinson <wstinson@infonie.fr>
Thu, 1 Aug 2002 05:25:55 +0000 (22:25 -0700)
committerChristoph Hellwig <hch@sb.bsdonline.org>
Thu, 1 Aug 2002 05:25:55 +0000 (22:25 -0700)
this is a small patch for boardergo.c linux driver for isdn HYSDN cards to
    1) remove call to check_region using request_region instead
    2) check the status of call to request_region
    3) release allocated region resource in case of error.

I don't have this hardware so compilation checked only.

drivers/isdn/hysdn/boardergo.c

index 67c245a886c34c9354064a06f65e3a02495fe508..aae47971c5f0517f1f2609a65b70aded42e1cb92 100644 (file)
@@ -424,16 +424,19 @@ ergo_releasehardware(hysdn_card * card)
 int
 ergo_inithardware(hysdn_card * card)
 {
-       if (check_region(card->iobase + PCI9050_INTR_REG, 1) ||
-           check_region(card->iobase + PCI9050_USER_IO, 1))
+       if (!request_region(card->iobase + PCI9050_INTR_REG, 1, "HYSDN")) 
+               return (-1);
+       if (!request_region(card->iobase + PCI9050_USER_IO, 1, "HYSDN")) {
+               release_region(card->iobase + PCI9050_INTR_REG, 1);
                return (-1);    /* ports already in use */
-
+       }
        card->memend = card->membase + ERG_DPRAM_PAGE_SIZE - 1;
-       if (!(card->dpram = ioremap(card->membase, ERG_DPRAM_PAGE_SIZE)))
+       if (!(card->dpram = ioremap(card->membase, ERG_DPRAM_PAGE_SIZE))) {
+               release_region(card->iobase + PCI9050_INTR_REG, 1);
+               release_region(card->iobase + PCI9050_USER_IO, 1);
                return (-1);
+       }
 
-       request_region(card->iobase + PCI9050_INTR_REG, 1, "HYSDN");
-       request_region(card->iobase + PCI9050_USER_IO, 1, "HYSDN");
        ergo_stopcard(card);    /* disable interrupts */
        if (request_irq(card->irq, ergo_interrupt, SA_SHIRQ, "HYSDN", card)) {
                ergo_releasehardware(card); /* return the acquired hardware */