int init_module(void) { struct net_device *dev; int this_dev, found = 0; for (this_dev = 0; this_dev < MAX_ES_CARDS; this_dev++) { if (io[this_dev] == 0 && this_dev != 0) break; dev = alloc_ei_netdev(); if (!dev) break; dev->irq = irq[this_dev]; dev->base_addr = io[this_dev]; dev->mem_start = mem[this_dev]; if (do_es_probe(dev) == 0) { if (register_netdev(dev) == 0) { dev_es3210[found++] = dev; continue; } cleanup_card(dev); } free_netdev(dev); printk(KERN_WARNING "es3210.c: No es3210 card found (i/o = 0x%x).\n", io[this_dev]); break; } if (found) return 0; return -ENXIO; }
struct net_device * __init es_probe(int unit) { struct net_device *dev = alloc_ei_netdev(); int err; if (!dev) return ERR_PTR(-ENOMEM); sprintf(dev->name, "eth%d", unit); netdev_boot_setup_check(dev); err = do_es_probe(dev); if (err) goto out; return dev; out: free_netdev(dev); return ERR_PTR(err); }