Commit 4f75fe2d authored by Alexander Viro's avatar Alexander Viro Committed by Stephen Hemminger

[netdrvr zorro8390] alloc_etherdev, SET_MODULE_OWNER

parent f2bdfb61
......@@ -103,18 +103,19 @@ static int __init zorro8390_probe(void)
continue;
board = z->resource.start;
ioaddr = board+cards[i].offset;
dev = init_etherdev(0, 0);
SET_MODULE_OWNER(dev);
dev = alloc_etherdev(0);
if (!dev)
return -ENOMEM;
dev->priv = NULL;
SET_MODULE_OWNER(dev);
if (!request_mem_region(ioaddr, NE_IO_EXTENT*2, dev->name)) {
kfree(dev);
free_netdev(dev);
continue;
}
if ((err = zorro8390_init(dev, board, cards[i].name,
ZTWO_VADDR(ioaddr)))) {
release_mem_region(ioaddr, NE_IO_EXTENT*2);
kfree(dev);
free_netdev(dev);
return err;
}
err = 0;
......@@ -129,6 +130,7 @@ static int __init zorro8390_init(struct net_device *dev, unsigned long board,
const char *name, unsigned long ioaddr)
{
int i;
int err;
unsigned char SA_prom[32];
int start_page, stop_page;
static u32 zorro8390_offsets[16] = {
......@@ -198,6 +200,7 @@ static int __init zorro8390_init(struct net_device *dev, unsigned long board,
/* Allocate dev->priv and fill in 8390 specific dev fields. */
if (ethdev_init(dev)) {
printk("Unable to get memory for dev->priv.\n");
free_irq(IRQ_AMIGA_PORTS, dev);
return -ENOMEM;
}
......@@ -232,7 +235,12 @@ static int __init zorro8390_init(struct net_device *dev, unsigned long board,
root_zorro8390_dev = dev;
#endif
NS8390_init(dev, 0);
return 0;
err = register_netdev(dev);
if (err) {
kfree(dev->priv);
free_irq(IRQ_AMIGA_PORTS, dev);
}
return err;
}
static int zorro8390_open(struct net_device *dev)
......@@ -413,6 +421,7 @@ static void __exit zorro8390_cleanup(void)
unregister_netdev(dev);
free_irq(IRQ_AMIGA_PORTS, dev);
release_mem_region(ZTWO_PADDR(dev->base_addr), NE_IO_EXTENT*2);
kfree(dev->priv);
free_netdev(dev);
root_zorro8390_dev = next;
}
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment