Commit 8184914d authored by David S. Miller's avatar David S. Miller

Merge nuts.ninka.net:/home/davem/src/BK/network-2.5

into nuts.ninka.net:/home/davem/src/BK/net-2.5
parents 9be2217a 78cf0a67
......@@ -292,37 +292,19 @@ static void e100_set_network_leds(int active);
*/
static int __init
etrax_ethernet_init(struct net_device *dev)
etrax_ethernet_init(void)
{
int i;
struct net_device *dev;
int i, err;
int anOffset = 0;
printk("ETRAX 100LX 10/100MBit ethernet v2.0 (c) 2000-2001 Axis Communications AB\n");
dev->base_addr = (unsigned int)R_NETWORK_SA_0; /* just to have something to show */
printk("%s initialized\n", dev->name);
/* make Linux aware of the new hardware */
if (!dev) {
printk(KERN_WARNING "%s: dev == NULL. Should this happen?\n",
cardname);
dev = init_etherdev(dev, sizeof(struct net_local));
dev = alloc_etherdev(sizeof(struct net_local));
if (!dev)
panic("init_etherdev failed\n");
}
/* setup generic handlers and stuff in the dev struct */
ether_setup(dev);
/* make room for the local structure containing stats etc */
dev->priv = kmalloc(sizeof(struct net_local), GFP_KERNEL);
if (dev->priv == NULL)
return -ENOMEM;
memset(dev->priv, 0, sizeof(struct net_local));
dev->base_addr = (unsigned int)R_NETWORK_SA_0; /* just to have something to show */
/* now setup our etrax specific stuff */
......@@ -340,10 +322,6 @@ etrax_ethernet_init(struct net_device *dev)
dev->do_ioctl = e100_ioctl;
dev->tx_timeout = e100_tx_timeout;
/* set the default MAC address */
e100_set_mac_address(dev, &default_mac);
/* Initialise the list of Etrax DMA-descriptors */
/* Initialise receive descriptors */
......@@ -371,6 +349,16 @@ etrax_ethernet_init(struct net_device *dev)
myLastRxDesc = &RxDescList[NBR_OF_RX_DESC - 1];
myPrevRxDesc = &RxDescList[NBR_OF_RX_DESC - 1];
err = register_netdev(dev);
if (err) {
kfree(dev);
return err;
}
/* set the default MAC address */
e100_set_mac_address(dev, &default_mac);
/* Initialize speed indicator stuff. */
current_speed = 10;
......@@ -1349,19 +1337,10 @@ e100_set_network_leds(int active)
}
}
static struct net_device dev_etrax_ethernet; /* only got one */
static int
etrax_init_module(void)
{
struct net_device *d = &dev_etrax_ethernet;
d->init = etrax_ethernet_init;
if (register_netdev(d) == 0)
return 0;
else
return -ENODEV;
return etrax_ethernet_init();
}
module_init(etrax_init_module);
......@@ -162,37 +162,19 @@ extern unsigned char e100lpslaveprog;
* (detachable devices only).
*/
static int __init
etrax_ethernet_lpslave_init(struct net_device *dev)
etrax_ethernet_lpslave_init(void)
{
int i;
struct net_device *dev;
int i, err;
int anOffset = 0;
printk("Etrax/100 lpslave ethernet driver v0.3, (c) 1999 Axis Communications AB\n");
dev->base_addr = 2;
printk("%s initialized\n", dev->name);
/* make Linux aware of the new hardware */
if (!dev) {
printk(KERN_WARNING "%s: dev == NULL. Should this happen?\n",
cardname);
dev = init_etherdev(dev, sizeof(struct net_local));
dev = alloc_etherdev(sizeof(struct net_lock));
if (!dev)
panic("init_etherdev failed\n");
}
/* setup generic handlers and stuff in the dev struct */
ether_setup(dev);
/* make room for the local structure containing stats etc */
dev->priv = kmalloc(sizeof(struct net_local), GFP_KERNEL);
if (dev->priv == NULL)
return -ENOMEM;
memset(dev->priv, 0, sizeof(struct net_local));
dev->base_addr = 2;
/* now setup our etrax specific stuff */
......@@ -242,7 +224,11 @@ etrax_ethernet_lpslave_init(struct net_device *dev)
TxDescList[0].buf = virt_to_phys(&host_command);
TxDescList[0].next = virt_to_phys(&TxDescList[1]);
return 0;
err = register_netdev(dev);
if (err)
kfree(dev);
return err;
}
/* set MAC address of the interface. called from the core after a
......@@ -1017,19 +1003,10 @@ dump_parport_status(void)
}
#endif /* ETHDEBUG */
static struct net_device dev_etrax_slave_ethernet;
static int
etrax_init_module(void)
{
struct net_device *d = &dev_etrax_slave_ethernet;
d->init = etrax_ethernet_lpslave_init;
if(register_netdev(d) == 0)
return 0;
else
return -ENODEV;
return etrax_ethernet_lpslave_init();
}
module_init(etrax_init_module);
......@@ -191,7 +191,7 @@ simeth_probe1(void)
unsigned char mac_addr[ETH_ALEN];
struct simeth_local *local;
struct net_device *dev;
int fd, i;
int fd, i, err;
/*
* XXX Fix me
......@@ -207,22 +207,12 @@ simeth_probe1(void)
if (fd == -1)
return -ENODEV;
dev = init_etherdev(NULL, sizeof(struct simeth_local));
dev = alloc_etherdev(sizeof(struct simeth_local));
if (!dev)
return -ENOMEM;
memcpy(dev->dev_addr, mac_addr, sizeof(mac_addr));
dev->irq = ia64_alloc_vector();
/*
* attach the interrupt in the simulator, this does enable interrupts
* until a netdev_attach() is called
*/
netdev_connect(dev->irq);
memset(dev->priv, 0, sizeof(struct simeth_local));
local = dev->priv;
local->simfd = fd; /* keep track of underlying file descriptor */
......@@ -232,8 +222,19 @@ simeth_probe1(void)
dev->get_stats = simeth_get_stats;
dev->set_multicast_list = set_multicast_list; /* no yet used */
/* Fill in the fields of the device structure with ethernet-generic values. */
ether_setup(dev);
err = register_netdev(dev);
if (dev) {
kfree(dev);
return err;
}
dev->irq = ia64_alloc_vector();
/*
* attach the interrupt in the simulator, this does enable interrupts
* until a netdev_attach() is called
*/
netdev_connect(dev->irq);
printk(KERN_INFO "%s: hosteth=%s simfd=%d, HwAddr",
dev->name, simeth_device, local->simfd);
......
......@@ -630,19 +630,15 @@ int __init scc_enet_init(void)
bd = (bd_t *)__res;
/* Allocate some private information.
/* Create an Ethernet device instance.
*/
cep = (struct scc_enet_private *)kmalloc(sizeof(*cep), GFP_KERNEL);
if (cep == NULL)
dev = alloc_etherdev(sizeof(*cep));
if (!dev)
return -ENOMEM;
__clear_user(cep,sizeof(*cep));
cep = dev->priv;
spin_lock_init(&cep->lock);
/* Create an Ethernet device instance.
*/
dev = init_etherdev(0, 0);
/* Get pointer to SCC area in parameter RAM.
*/
ep = (scc_enet_t *)(&immap->im_dprambase[PROFF_ENET]);
......@@ -771,6 +767,7 @@ int __init scc_enet_init(void)
/* Allocate a page.
*/
mem_addr = __get_free_page(GFP_KERNEL);
/* BUG: no check for failure */
/* Initialize the BD for every fragment in the page.
*/
......@@ -808,6 +805,7 @@ int __init scc_enet_init(void)
/* Install our interrupt handler.
*/
request_irq(SIU_INT_ENET, scc_enet_interrupt, 0, "enet", dev);
/* BUG: no check for failure */
/* Set GSMR_H to enable all normal operating modes.
* Set GSMR_L to enable Ethernet to MC68160.
......@@ -837,7 +835,6 @@ int __init scc_enet_init(void)
io->iop_pdatc |= PC_EST8260_ENET_NOTFD;
dev->base_addr = (unsigned long)ep;
dev->priv = cep;
/* The CPM Ethernet specific entries in the device structure. */
dev->open = scc_enet_open;
......@@ -852,6 +849,12 @@ int __init scc_enet_init(void)
*/
sccp->scc_gsmrl |= (SCC_GSMRL_ENR | SCC_GSMRL_ENT);
err = register_netdev(dev);
if (err) {
kfree(dev);
return err;
}
printk("%s: SCC ENET Version 0.1, ", dev->name);
for (i=0; i<5; i++)
printk("%02x:", dev->dev_addr[i]);
......
......@@ -1328,7 +1328,7 @@ int __init fec_enet_init(void)
struct net_device *dev;
struct fcc_enet_private *cep;
fcc_info_t *fip;
int i, np;
int i, np, err;
volatile immap_t *immap;
volatile iop8260_t *io;
......@@ -1339,23 +1339,16 @@ int __init fec_enet_init(void)
fip = fcc_ports;
while (np-- > 0) {
/* Allocate some private information.
/* Create an Ethernet device instance.
*/
cep = (struct fcc_enet_private *)
kmalloc(sizeof(*cep), GFP_KERNEL);
if (cep == NULL)
dev = alloc_etherdev(sizeof(*cep));
if (!dev)
return -ENOMEM;
__clear_user(cep,sizeof(*cep));
cep = dev->priv;
spin_lock_init(&cep->lock);
cep->fip = fip;
/* Create an Ethernet device instance.
*/
dev = init_etherdev(0, 0);
dev->priv = cep;
init_fcc_shutdown(fip, cep, immap);
init_fcc_ioports(fip, io, immap);
init_fcc_param(fip, dev, immap);
......@@ -1376,6 +1369,12 @@ int __init fec_enet_init(void)
init_fcc_startup(fip, dev);
err = register_netdev(dev);
if (err) {
kfree(dev);
return err;
}
printk("%s: FCC ENET Version 0.3, ", dev->name);
for (i=0; i<5; i++)
printk("%02x:", dev->dev_addr[i]);
......
......@@ -643,7 +643,7 @@ int __init scc_enet_init(void)
{
struct net_device *dev;
struct scc_enet_private *cep;
int i, j, k;
int i, j, k, err;
unsigned char *eap, *ba;
dma_addr_t mem_addr;
bd_t *bd;
......@@ -659,19 +659,13 @@ int __init scc_enet_init(void)
bd = (bd_t *)__res;
/* Allocate some private information.
*/
cep = (struct scc_enet_private *)kmalloc(sizeof(*cep), GFP_KERNEL);
if (cep == NULL)
dev = alloc_etherdev(sizeof(*cep));
if (!dev)
return -ENOMEM;
__clear_user(cep,sizeof(*cep));
cep = dev->priv;
spin_lock_init(&cep->lock);
/* Create an Ethernet device instance.
*/
dev = init_etherdev(0, 0);
/* Get pointer to SCC area in parameter RAM.
*/
ep = (scc_enet_t *)(&cp->cp_dparam[PROFF_ENET]);
......@@ -841,6 +835,7 @@ int __init scc_enet_init(void)
/* Allocate a page.
*/
ba = (unsigned char *)consistent_alloc(GFP_KERNEL, PAGE_SIZE, &mem_addr);
/* BUG: no check for failure */
/* Initialize the BD for every fragment in the page.
*/
......@@ -939,7 +934,6 @@ int __init scc_enet_init(void)
#endif
dev->base_addr = (unsigned long)ep;
dev->priv = cep;
#if 0
dev->name = "CPM_ENET";
#endif
......@@ -953,6 +947,12 @@ int __init scc_enet_init(void)
dev->get_stats = scc_enet_get_stats;
dev->set_multicast_list = set_multicast_list;
err = register_netdev(dev);
if (err) {
kfree(dev);
return err;
}
/* And last, enable the transmit and receive processing.
*/
sccp->scc_gsmrl |= (SCC_GSMRL_ENR | SCC_GSMRL_ENT);
......
......@@ -1570,7 +1570,7 @@ int __init fec_enet_init(void)
{
struct net_device *dev;
struct fec_enet_private *fep;
int i, j, k;
int i, j, k, err;
unsigned char *eap, *iap, *ba;
unsigned long mem_addr;
volatile cbd_t *bdp;
......@@ -1586,17 +1586,11 @@ int __init fec_enet_init(void)
bd = (bd_t *)__res;
/* Allocate some private information.
*/
fep = (struct fec_enet_private *)kmalloc(sizeof(*fep), GFP_KERNEL);
if (fep == NULL)
dev = alloc_etherdev(sizeof(*fep));
if (!dev)
return -ENOMEM;
__clear_user(fep,sizeof(*fep));
/* Create an Ethernet device instance.
*/
dev = init_etherdev(0, 0);
fep = dev->priv;
fecp = &(immap->im_cpm.cp_fec);
......@@ -1661,6 +1655,7 @@ int __init fec_enet_init(void)
/* Allocate a page.
*/
ba = (unsigned char *)consistent_alloc(GFP_KERNEL, PAGE_SIZE, &mem_addr);
/* BUG: no check for failure */
/* Initialize the BD for every fragment in the page.
*/
......@@ -1715,7 +1710,6 @@ int __init fec_enet_init(void)
#endif
dev->base_addr = (unsigned long)fecp;
dev->priv = fep;
/* The FEC Ethernet specific entries in the device structure. */
dev->open = fec_enet_open;
......@@ -1752,6 +1746,12 @@ int __init fec_enet_init(void)
fecp->fec_mii_speed = 0; /* turn off MDIO */
#endif /* CONFIG_USE_MDIO */
err = register_netdev(dev);
if (err) {
kfree(dev);
return err;
}
printk ("%s: FEC ENET Version 0.2, FEC irq %d"
#ifdef PHY_INTERRUPT
", MII irq %d"
......
......@@ -1331,12 +1331,13 @@ static void __init bmac_probe1(struct device_node *bmac, int is_bmac_plus)
}
}
dev = init_etherdev(NULL, PRIV_BYTES);
dev = alloc_etherdev(PRIV_BYTES);
if (!dev) {
printk(KERN_ERR "init_etherdev failed, out of memory for BMAC %s\n",
printk(KERN_ERR "alloc_etherdev failed, out of memory for BMAC %s\n",
bmac->full_name);
return;
}
bp = (struct bmac_data *) dev->priv;
SET_MODULE_OWNER(dev);
bp->node = bmac;
......@@ -1344,21 +1345,22 @@ static void __init bmac_probe1(struct device_node *bmac, int is_bmac_plus)
if (!request_OF_resource(bmac, 0, " (bmac)")) {
printk(KERN_ERR "BMAC: can't request IO resource !\n");
goto err_out;
goto out1;
}
if (!request_OF_resource(bmac, 1, " (bmac tx dma)")) {
printk(KERN_ERR "BMAC: can't request TX DMA resource !\n");
goto err_out;
goto out2;
}
if (!request_OF_resource(bmac, 2, " (bmac rx dma)")) {
printk(KERN_ERR "BMAC: can't request RX DMA resource !\n");
goto err_out;
goto out3;
}
dev->base_addr = (unsigned long)
ioremap(bmac->addrs[0].address, bmac->addrs[0].size);
if (!dev->base_addr)
goto err_out;
goto out4;
dev->irq = bmac->intrs[0].line;
bmac_enable_and_reset_chip(dev);
......@@ -1430,10 +1432,18 @@ static void __init bmac_probe1(struct device_node *bmac, int is_bmac_plus)
disable_irq(dev->irq);
pmac_call_feature(PMAC_FTR_BMAC_ENABLE, bp->node, 0, 0);
if (register_netdev(dev) != 0) {
printk(KERN_ERR "registration failed for BMAC %s\n",
bmac->full_name);
goto err_out_irq2;
}
bp->next_bmac = bmac_devs;
bmac_devs = dev;
return;
err_out_irq2:
free_irq(bmac->intrs[2].line, dev);
err_out_irq1:
free_irq(bmac->intrs[1].line, dev);
err_out_irq0:
......@@ -1444,14 +1454,14 @@ static void __init bmac_probe1(struct device_node *bmac, int is_bmac_plus)
iounmap((void *)bp->tx_dma);
err_out_iounmap:
iounmap((void *)dev->base_addr);
err_out:
if (bp->node) {
release_OF_resource(bp->node, 0);
release_OF_resource(bp->node, 1);
out4:
release_OF_resource(bp->node, 2);
out3:
release_OF_resource(bp->node, 1);
out2:
release_OF_resource(bp->node, 0);
out1:
pmac_call_feature(PMAC_FTR_BMAC_ENABLE, bp->node, 0, 0);
}
unregister_netdev(dev);
kfree(dev);
}
......
......@@ -329,6 +329,12 @@ static void ax_bump(struct ax_disp *ax)
return;
}
ax->rcount -= 2;
/* dl9sau bugfix: the trailling two bytes flexnet crc
* will not be passed to the kernel. thus we have
* to correct the kissparm signature, because it
* indicates a crc but there's none
*/
*ax->rbuff &= ~0x20;
}
}
......
......@@ -722,34 +722,31 @@ static int __init qec_ether_init(struct net_device *dev, struct sbus_dev *sdev)
struct net_device *qe_devs[4];
struct sunqe *qeps[4];
struct sbus_dev *qesdevs[4];
struct sbus_dev *child;
struct sunqec *qecp = NULL;
u8 bsizes, bsizes_more;
int i, j, res = ENOMEM;
int i, j, res = -ENOMEM;
dev = init_etherdev(0, sizeof(struct sunqe));
qe_devs[0] = dev;
qeps[0] = (struct sunqe *) dev->priv;
qeps[0]->channel = 0;
spin_lock_init(&qeps[0]->lock);
for (j = 0; j < 6; j++)
qe_devs[0]->dev_addr[j] = idprom->id_ethaddr[j];
for (i = 0; i < 4; i++) {
qe_devs[i] = alloc_etherdev(sizeof(struct sunqe));
if (!qe_devs[i])
goto out;
}
if (version_printed++ == 0)
printk(KERN_INFO "%s", version);
qe_devs[1] = qe_devs[2] = qe_devs[3] = NULL;
for (i = 1; i < 4; i++) {
qe_devs[i] = init_etherdev(0, sizeof(struct sunqe));
if (qe_devs[i] == NULL || qe_devs[i]->priv == NULL)
goto qec_free_devs;
for (i = 0; i < 4; i++) {
qeps[i] = (struct sunqe *) qe_devs[i]->priv;
for (j = 0; j < 6; j++)
qe_devs[i]->dev_addr[j] = idprom->id_ethaddr[j];
qeps[i]->channel = i;
spin_lock_init(&qeps[i]->lock);
}
qecp = kmalloc(sizeof(struct sunqec), GFP_KERNEL);
if (qecp == NULL)
goto qec_free_devs;
goto out1;
qecp->qec_sdev = sdev;
for (i = 0; i < 4; i++) {
......@@ -758,25 +755,15 @@ static int __init qec_ether_init(struct net_device *dev, struct sbus_dev *sdev)
qeps[i]->parent = qecp;
}
/* Link in channel 0. */
i = prom_getintdefault(sdev->child->prom_node, "channel#", -1);
if (i == -1) { res=ENODEV; goto qec_free_devs; }
qesdevs[i] = sdev->child;
/* Link in channel 1. */
i = prom_getintdefault(sdev->child->next->prom_node, "channel#", -1);
if (i == -1) { res=ENODEV; goto qec_free_devs; }
qesdevs[i] = sdev->child->next;
/* Link in channel 2. */
i = prom_getintdefault(sdev->child->next->next->prom_node, "channel#", -1);
if (i == -1) { res=ENODEV; goto qec_free_devs; }
qesdevs[i] = sdev->child->next->next;
res = -ENODEV;
/* Link in channel 3. */
i = prom_getintdefault(sdev->child->next->next->next->prom_node, "channel#", -1);
if (i == -1) { res=ENODEV; goto qec_free_devs; }
qesdevs[i] = sdev->child->next->next->next;
for (i = 0, child = sdev->child; i < 4; i++, child = child->next) {
/* Link in channel */
j = prom_getintdefault(child->prom_node, "channel#", -1);
if (j == -1)
goto out2;
qesdevs[j] = child;
}
for (i = 0; i < 4; i++)
qeps[i]->qe_sdev = qesdevs[i];
......@@ -786,22 +773,18 @@ static int __init qec_ether_init(struct net_device *dev, struct sbus_dev *sdev)
GLOB_REG_SIZE, "QEC Global Registers");
if (!qecp->gregs) {
printk(KERN_ERR "QuadEther: Cannot map QEC global registers.\n");
res = ENODEV;
goto qec_free_devs;
goto out2;
}
/* Make sure the QEC is in MACE mode. */
if ((sbus_readl(qecp->gregs + GLOB_CTRL) & 0xf0000000) != GLOB_CTRL_MMODE) {
printk(KERN_ERR "QuadEther: AIEEE, QEC is not in MACE mode!\n");
res = ENODEV;
goto qec_free_devs;
goto out3;
}
/* Reset the QEC. */
if (qec_global_reset(qecp->gregs)) {
res = ENODEV;
goto qec_free_devs;
}
if (qec_global_reset(qecp->gregs))
goto out3;
/* Find and set the burst sizes for the QEC, since it does
* the actual dma for all 4 channels.
......@@ -824,40 +807,36 @@ static int __init qec_ether_init(struct net_device *dev, struct sbus_dev *sdev)
qec_init_once(qecp, sdev);
for (i = 0; i < 4; i++) {
struct sunqe *qe = qeps[i];
/* Map in QEC per-channel control registers. */
qeps[i]->qcregs = sbus_ioremap(&qesdevs[i]->resource[0], 0,
qe->qcregs = sbus_ioremap(&qe->qe_sdev->resource[0], 0,
CREG_REG_SIZE, "QEC Channel Registers");
if (!qeps[i]->qcregs) {
if (!qe->qcregs) {
printk(KERN_ERR "QuadEther: Cannot map QE %d's channel registers.\n", i);
res = ENODEV;
goto qec_free_devs;
goto out4;
}
/* Map in per-channel AMD MACE registers. */
qeps[i]->mregs = sbus_ioremap(&qesdevs[i]->resource[1], 0,
qe->mregs = sbus_ioremap(&qe->qe_sdev->resource[1], 0,
MREGS_REG_SIZE, "QE MACE Registers");
if (!qeps[i]->mregs) {
if (!qe->mregs) {
printk(KERN_ERR "QuadEther: Cannot map QE %d's MACE registers.\n", i);
res = ENODEV;
goto qec_free_devs;
goto out4;
}
qeps[i]->qe_block = sbus_alloc_consistent(qesdevs[i],
qe->qe_block = sbus_alloc_consistent(qe->qe_sdev,
PAGE_SIZE,
&qeps[i]->qblock_dvma);
qeps[i]->buffers = sbus_alloc_consistent(qesdevs[i],
&qe->qblock_dvma);
qe->buffers = sbus_alloc_consistent(qe->qe_sdev,
sizeof(struct sunqe_buffers),
&qeps[i]->buffers_dvma);
if (qeps[i]->qe_block == NULL ||
qeps[i]->qblock_dvma == 0 ||
qeps[i]->buffers == NULL ||
qeps[i]->buffers_dvma == 0) {
res = ENODEV;
goto qec_free_devs;
&qe->buffers_dvma);
if (qe->qe_block == NULL || qe->qblock_dvma == 0 ||
qe->buffers == NULL || qe->buffers_dvma == 0) {
goto out4;
}
/* Stop this QE. */
qe_stop(qeps[i]);
qe_stop(qe);
}
for (i = 0; i < 4; i++) {
......@@ -871,7 +850,6 @@ static int __init qec_ether_init(struct net_device *dev, struct sbus_dev *sdev)
qe_devs[i]->watchdog_timeo = 5*HZ;
qe_devs[i]->irq = sdev->irqs[0];
qe_devs[i]->dma = 0;
ether_setup(qe_devs[i]);
}
/* QEC receives interrupts from each QE, then it sends the actual
......@@ -882,8 +860,13 @@ static int __init qec_ether_init(struct net_device *dev, struct sbus_dev *sdev)
if (request_irq(sdev->irqs[0], &qec_interrupt,
SA_SHIRQ, "QuadEther", (void *) qecp)) {
printk(KERN_ERR "QuadEther: Can't register QEC master irq handler.\n");
res = EAGAIN;
goto qec_free_devs;
res = -EAGAIN;
goto out4;
}
for (i = 0; i < 4; i++) {
if (register_netdev(qe_devs[i]) != 0)
goto out5;
}
/* Report the QE channels. */
......@@ -899,42 +882,43 @@ static int __init qec_ether_init(struct net_device *dev, struct sbus_dev *sdev)
/* We are home free at this point, link the qe's into
* the master list for later driver exit.
*/
for (i = 0; i < 4; i++)
qe_devs[i]->ifindex = dev_new_index();
qecp->next_module = root_qec_dev;
root_qec_dev = qecp;
return 0;
qec_free_devs:
out5:
while (i--)
unregister_netdev(qe_devs[i]);
free_irq(sdev->irqs[0], (void *)qecp);
out4:
for (i = 0; i < 4; i++) {
if (qe_devs[i] != NULL) {
if (qe_devs[i]->priv) {
struct sunqe *qe = (struct sunqe *)qe_devs[i]->priv;
if (qe->qcregs)
sbus_iounmap(qe->qcregs, CREG_REG_SIZE);
if (qe->mregs)
sbus_iounmap(qe->mregs, MREGS_REG_SIZE);
if (qe->qe_block != NULL)
if (qe->qe_block)
sbus_free_consistent(qe->qe_sdev,
PAGE_SIZE,
qe->qe_block,
qe->qblock_dvma);
if (qe->buffers != NULL)
if (qe->buffers)
sbus_free_consistent(qe->qe_sdev,
sizeof(struct sunqe_buffers),
qe->buffers,
qe->buffers_dvma);
}
kfree(qe_devs[i]);
}
}
if (qecp != NULL) {
if (qecp->gregs)
out3:
sbus_iounmap(qecp->gregs, GLOB_REG_SIZE);
out2:
kfree(qecp);
}
out1:
i = 4;
out:
while (i--)
kfree(qe_devs[i]);
return res;
}
......
......@@ -9,6 +9,7 @@
#include <linux/crypto.h>
#include <linux/pfkeyv2.h>
#include <linux/in6.h>
#include <linux/slab.h>
#include <net/sock.h>
#include <net/dst.h>
......
......@@ -154,9 +154,15 @@ int ax25_rebuild_header(struct sk_buff *skb)
skb_set_owner_w(ourskb, skb->sk);
kfree_skb(skb);
src_c = *src;
dst_c = *dst;
/* dl9sau: bugfix
* after kfree_skb(), dst and src which were pointer
* to bp which is part of skb->data would not be valid
* anymore hope that after skb_pull(ourskb, ..) our
* dsc_c and src_c will not become invalid
*/
bp = ourskb->data;
dst_c = *(ax25_address *)(bp + 1);
src_c = *(ax25_address *)(bp + 8);
skb_pull(ourskb, AX25_HEADER_LEN - 1); /* Keep PID */
ourskb->nh.raw = ourskb->data;
......
......@@ -11,6 +11,7 @@
#include <linux/mm.h>
#include <linux/random.h>
#include <linux/init.h>
#include <linux/slab.h>
#include <net/flow.h>
#include <asm/atomic.h>
......
......@@ -9,6 +9,7 @@
*
*/
#include <linux/slab.h>
#include <net/ip.h>
#include <net/xfrm.h>
......
......@@ -14,6 +14,7 @@
*/
#include <linux/config.h>
#include <linux/slab.h>
#include <net/xfrm.h>
#include <net/ip.h>
......
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