"must specify the base address!\n");
return -ENODEV;
}
- if (check_region(ioaddr, ARCNET_TOTAL_SIZE)) {
+ if (!request_region(ioaddr, ARCNET_TOTAL_SIZE, "com90io probe")) {
BUGMSG(D_INIT_REASONS, "IO check_region %x-%x failed.\n",
ioaddr, ioaddr + ARCNET_TOTAL_SIZE - 1);
return -ENXIO;
}
if (ASTATUS() == 0xFF) {
BUGMSG(D_INIT_REASONS, "IO address %x empty\n", ioaddr);
- return -ENODEV;
+ goto err_out;
}
inb(_RESET);
mdelay(RESETtime);
if ((status & 0x9D) != (NORXflag | RECONflag | TXFREEflag | RESETflag)) {
BUGMSG(D_INIT_REASONS, "Status invalid (%Xh).\n", status);
- return -ENODEV;
+ goto err_out;
}
BUGMSG(D_INIT_REASONS, "Status after reset: %X\n", status);
if (status & RESETflag) {
BUGMSG(D_INIT_REASONS, "Eternal reset (status=%Xh)\n", status);
- return -ENODEV;
+ goto err_out;
}
outb((0x16 | IOMAPflag) & ~ENABLE16flag, _CONFIG);
if ((status = inb(_MEMDATA)) != 0xd1) {
BUGMSG(D_INIT_REASONS, "Signature byte not found"
" (%Xh instead).\n", status);
- return -ENODEV;
+ goto err_out;
}
if (!dev->irq) {
/*
if (dev->irq <= 0) {
BUGMSG(D_INIT_REASONS, "Autoprobe IRQ failed\n");
- return -ENODEV;
+ goto err_out;
}
}
+ release_region(ioaddr, ARCNET_TOTAL_SIZE); /* end of probing */
return com90io_found(dev);
+
+err_out:
+ release_region(ioaddr, ARCNET_TOTAL_SIZE);
+ return -ENODEV;
}