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) ...@@ -103,18 +103,19 @@ static int __init zorro8390_probe(void)
continue; continue;
board = z->resource.start; board = z->resource.start;
ioaddr = board+cards[i].offset; ioaddr = board+cards[i].offset;
dev = init_etherdev(0, 0); dev = alloc_etherdev(0);
SET_MODULE_OWNER(dev);
if (!dev) if (!dev)
return -ENOMEM; return -ENOMEM;
dev->priv = NULL;
SET_MODULE_OWNER(dev);
if (!request_mem_region(ioaddr, NE_IO_EXTENT*2, dev->name)) { if (!request_mem_region(ioaddr, NE_IO_EXTENT*2, dev->name)) {
kfree(dev); free_netdev(dev);
continue; continue;
} }
if ((err = zorro8390_init(dev, board, cards[i].name, if ((err = zorro8390_init(dev, board, cards[i].name,
ZTWO_VADDR(ioaddr)))) { ZTWO_VADDR(ioaddr)))) {
release_mem_region(ioaddr, NE_IO_EXTENT*2); release_mem_region(ioaddr, NE_IO_EXTENT*2);
kfree(dev); free_netdev(dev);
return err; return err;
} }
err = 0; err = 0;
...@@ -129,6 +130,7 @@ static int __init zorro8390_init(struct net_device *dev, unsigned long board, ...@@ -129,6 +130,7 @@ static int __init zorro8390_init(struct net_device *dev, unsigned long board,
const char *name, unsigned long ioaddr) const char *name, unsigned long ioaddr)
{ {
int i; int i;
int err;
unsigned char SA_prom[32]; unsigned char SA_prom[32];
int start_page, stop_page; int start_page, stop_page;
static u32 zorro8390_offsets[16] = { static u32 zorro8390_offsets[16] = {
...@@ -198,6 +200,7 @@ static int __init zorro8390_init(struct net_device *dev, unsigned long board, ...@@ -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. */ /* Allocate dev->priv and fill in 8390 specific dev fields. */
if (ethdev_init(dev)) { if (ethdev_init(dev)) {
printk("Unable to get memory for dev->priv.\n"); printk("Unable to get memory for dev->priv.\n");
free_irq(IRQ_AMIGA_PORTS, dev);
return -ENOMEM; return -ENOMEM;
} }
...@@ -232,7 +235,12 @@ static int __init zorro8390_init(struct net_device *dev, unsigned long board, ...@@ -232,7 +235,12 @@ static int __init zorro8390_init(struct net_device *dev, unsigned long board,
root_zorro8390_dev = dev; root_zorro8390_dev = dev;
#endif #endif
NS8390_init(dev, 0); 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) static int zorro8390_open(struct net_device *dev)
...@@ -413,6 +421,7 @@ static void __exit zorro8390_cleanup(void) ...@@ -413,6 +421,7 @@ static void __exit zorro8390_cleanup(void)
unregister_netdev(dev); unregister_netdev(dev);
free_irq(IRQ_AMIGA_PORTS, dev); free_irq(IRQ_AMIGA_PORTS, dev);
release_mem_region(ZTWO_PADDR(dev->base_addr), NE_IO_EXTENT*2); release_mem_region(ZTWO_PADDR(dev->base_addr), NE_IO_EXTENT*2);
kfree(dev->priv);
free_netdev(dev); free_netdev(dev);
root_zorro8390_dev = next; 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