diff -urN /mnt/disk/linux/drivers/net/hp-plus.c /linux/drivers/net/hp-plus.c --- /mnt/disk/linux/drivers/net/hp-plus.c Fri Oct 13 21:40:06 2000 +++ /linux/drivers/net/hp-plus.c Mon Oct 16 19:16:49 2000 @@ -133,13 +133,9 @@ else if (base_addr != 0) /* Don't probe at all. */ return -ENXIO; - for (i = 0; hpplus_portlist[i]; i++) { - int ioaddr = hpplus_portlist[i]; - if (check_region(ioaddr, HP_IO_EXTENT)) - continue; - if (hpp_probe1(dev, ioaddr) == 0) + for (i = 0; hpplus_portlist[i]; i++) + if (hpp_probe1(dev, hpplus_portlist[i]) == 0) return 0; - } return -ENODEV; } @@ -148,21 +144,26 @@ /* Do the interesting part of the probe at a single address. */ int __init hpp_probe1(struct net_device *dev, int ioaddr) { - int i; + int i, retval; unsigned char checksum = 0; const char *name = "HP-PC-LAN+"; int mem_start; static unsigned version_printed = 0; + if (!request_region(ioaddr, HP_IO_EXTENT, "hp-plus")) + return -ENODEV; + /* Check for the HP+ signature, 50 48 0x 53. */ if (inw(ioaddr + HP_ID) != 0x4850 - || (inw(ioaddr + HP_PAGING) & 0xfff0) != 0x5300) - return -ENODEV; + || (inw(ioaddr + HP_PAGING) & 0xfff0) != 0x5300) { + retval = -ENODEV; + goto out; + } /* We should have a "dev" from Space.c or the static module table. */ if (dev == NULL) { printk("hp-plus.c: Passed a NULL device.\n"); - dev = init_etherdev(0, 0); + BUG(); } if (ei_debug && version_printed++ == 0) @@ -183,7 +184,8 @@ if (checksum != 0xff) { printk(" bad checksum %2.2x.\n", checksum); - return -ENODEV; + retval = -ENODEV; + goto out; } else { /* Point at the Software Configuration Flags. */ outw(ID_Page, ioaddr + HP_PAGING); @@ -193,12 +195,10 @@ /* Allocate dev->priv and fill in 8390 specific dev fields. */ if (ethdev_init(dev)) { printk ("hp-plus.c: unable to allocate memory for dev->priv.\n"); - return -ENOMEM; + retval = -ENOMEM; + goto out; } - /* Grab the region so we can find another board if something fails. */ - request_region(ioaddr, HP_IO_EXTENT,"hp-plus"); - /* Read the IRQ line. */ outw(HW_Page, ioaddr + HP_PAGING); { @@ -252,6 +252,9 @@ outw(inw(ioaddr + HPP_OPTION) & ~EnableIRQ, ioaddr + HPP_OPTION); return 0; +out: + release_region(ioaddr, HP_IO_EXTENT); + return retval; } static int