summaryrefslogtreecommitdiff
path: root/target/linux/adm5120-2.6/files
diff options
context:
space:
mode:
authorGabor Juhos <juhosg@openwrt.org>2007-07-20 09:07:18 +0000
committerGabor Juhos <juhosg@openwrt.org>2007-07-20 09:07:18 +0000
commitae7bf3d0f0a9fbf008a2cb16e089206f02c0cd66 (patch)
tree214b4ec4d8dcabaa32cef9ca75ada5690dcb293a /target/linux/adm5120-2.6/files
parentc452e6058af556db4ebdd14b1a863b3237af37d9 (diff)
downloadmtk-20170518-ae7bf3d0f0a9fbf008a2cb16e089206f02c0cd66.zip
mtk-20170518-ae7bf3d0f0a9fbf008a2cb16e089206f02c0cd66.tar.gz
mtk-20170518-ae7bf3d0f0a9fbf008a2cb16e089206f02c0cd66.tar.bz2
fix switch_driver to avoid segfaults
SVN-Revision: 8071
Diffstat (limited to 'target/linux/adm5120-2.6/files')
-rw-r--r--target/linux/adm5120-2.6/files/drivers/net/adm5120sw.c12
1 files changed, 6 insertions, 6 deletions
diff --git a/target/linux/adm5120-2.6/files/drivers/net/adm5120sw.c b/target/linux/adm5120-2.6/files/drivers/net/adm5120sw.c
index 83a311f..744a2da 100644
--- a/target/linux/adm5120-2.6/files/drivers/net/adm5120sw.c
+++ b/target/linux/adm5120-2.6/files/drivers/net/adm5120sw.c
@@ -262,7 +262,7 @@ static int adm5120_sw_open(struct net_device *dev)
{
unsigned long val;
int i;
-
+
netif_start_queue(dev);
if (!adm5120_if_open++) {
/* enable interrupts on first open */
@@ -284,7 +284,7 @@ static int adm5120_sw_stop(struct net_device *dev)
{
unsigned long val;
int i;
-
+
if (!--adm5120_if_open) {
adm5120_set_reg(ADM5120_INT_MASK, ADM5120_INTMASKALL);
}
@@ -321,7 +321,7 @@ static int adm5120_sw_tx(struct sk_buff *skb, struct net_device *dev)
dma->status =
((skb->len<ETH_ZLEN?ETH_ZLEN:skb->len) << ADM5120_DMA_LENSHIFT) |
(0x1 << priv->port);
-
+
dma->len = skb->len < ETH_ZLEN ? ETH_ZLEN : skb->len;
priv->stats.tx_packets++;
priv->stats.tx_bytes += skb->len;
@@ -554,7 +554,7 @@ static int __init adm5120_sw_init(void)
adm5120_set_reg(ADM5120_RECEIVE_HBADDR, KSEG1ADDR(adm5120_dma_rxh));
adm5120_set_reg(ADM5120_RECEIVE_LBADDR, KSEG1ADDR(adm5120_dma_rxl));
- for (i=0; i<adm5120_nrdevs; i++) {
+ for (i = 0; i < SW_DEVS; i++) {
adm5120_devs[i] = alloc_etherdev(sizeof(struct adm5120_sw));
if (!adm5120_devs[i]) {
err = -ENOMEM;
@@ -612,9 +612,9 @@ static void __exit adm5120_sw_exit(void)
{
int i;
- for (i = 0; i < adm5120_nrdevs; i++) {
+ for (i = 0; i < SW_DEVS; i++) {
unregister_netdev(adm5120_devs[i]);
- free_netdev(adm5120_devs[i-1]);
+ free_netdev(adm5120_devs[i]);
}
free_irq(ADM5120_IRQ_SWITCH, NULL);