Re: NE*0000 Fixes for 2.1.103 SMP and NonSMP

Richard B. Johnson (root@chaos.analogic.com)
Fri, 22 May 1998 20:01:45 -0400 (EDT)


On Fri, 22 May 1998, Chip Salzenberg wrote:
[snipped]
Yes. It has been fixed in a previous patch.

--- linux-2.1.103/drivers/net/ne.c.orig Thu Apr 9 19:20:29 1998
+++ linux-2.1.103/drivers/net/ne.c Fri May 22 13:04:40 1998
@@ -25,6 +25,9 @@
Paul Gortmaker : Support for PCI ne2k clones, similar to lance.c
Paul Gortmaker : Allow users with bad cards to avoid full probe.
Paul Gortmaker : PCI probe changes, more PCI cards supported.
+ rjohnson@analogic.com : Changed init order so an interrupt will only
+ occur after memory is allocated for dev->priv. Deallocated memory
+ last in cleanup_modue()

*/

@@ -416,6 +419,12 @@
return EAGAIN;
}

+ /* Allocate dev->priv and fill in 8390 specific dev fields. */
+ if (ethdev_init(dev)) {
+ printk (" unable to get memory for dev->priv.\n");
+ return -ENOMEM;
+ }
+
/* Snarf the interrupt now. There's no point in waiting since we cannot
share and the board will usually be enabled. */
{
@@ -423,19 +432,12 @@
pci_irq_line ? SA_SHIRQ : 0, name, dev);
if (irqval) {
printk (" unable to get IRQ %d (irqval=%d).\n", dev->irq, irqval);
+
+ kfree(dev->priv);
return EAGAIN;
}
}
-
dev->base_addr = ioaddr;
-
- /* 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(dev->irq, dev);
- return -ENOMEM;
- }
-
request_region(ioaddr, NE_IO_EXTENT, name);

for(i = 0; i < ETHER_ADDR_LEN; i++) {
@@ -774,10 +776,10 @@
struct device *dev = &dev_ne[this_dev];
if (dev->priv != NULL) {
unregister_netdev(dev);
- kfree(dev->priv);
- dev->priv = NULL;
free_irq(dev->irq, dev);
release_region(dev->base_addr, NE_IO_EXTENT);
+ kfree(dev->priv);
+ dev->priv = NULL;
}
}
}

Cheers,
Dick Johnson
***** FILE SYSTEM MODIFIED *****
Penguin : Linux version 2.1.103 on an i586 machine (66.15 BogoMips).
Warning : It's hard to remain at the trailing edge of technology.

-
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@vger.rutgers.edu