aboutsummaryrefslogtreecommitdiffstats
path: root/target/linux/mcs814x
diff options
context:
space:
mode:
authorFlorian Fainelli <florian@openwrt.org>2012-10-15 21:03:57 +0000
committerFlorian Fainelli <florian@openwrt.org>2012-10-15 21:03:57 +0000
commite910e78dba966a90ce42a39c7496c279b9d915cc (patch)
treec786e9938e6ba4cbc5691fd57931fc4cee73e9b4 /target/linux/mcs814x
parent86148ac69bbfb69d10b5118b6583fb0c94ede629 (diff)
downloadmaster-187ad058-e910e78dba966a90ce42a39c7496c279b9d915cc.tar.gz
master-187ad058-e910e78dba966a90ce42a39c7496c279b9d915cc.tar.bz2
master-187ad058-e910e78dba966a90ce42a39c7496c279b9d915cc.zip
[mcs814x] nuport-mac: various fixes
- properly check for the link up condition in the phylib adjust callback - do not assign skb->dev, eth_type_trans() already does it - handle skb allocation failures in the refill path git-svn-id: svn://svn.openwrt.org/openwrt/trunk@33780 3c298f89-4303-0410-b956-a3cf2f4a3e73
Diffstat (limited to 'target/linux/mcs814x')
-rw-r--r--target/linux/mcs814x/files-3.3/drivers/net/ethernet/mcs8140/nuport_mac.c8
1 files changed, 5 insertions, 3 deletions
diff --git a/target/linux/mcs814x/files-3.3/drivers/net/ethernet/mcs8140/nuport_mac.c b/target/linux/mcs814x/files-3.3/drivers/net/ethernet/mcs8140/nuport_mac.c
index fe95ea7f7d..2dc2375159 100644
--- a/target/linux/mcs814x/files-3.3/drivers/net/ethernet/mcs8140/nuport_mac.c
+++ b/target/linux/mcs814x/files-3.3/drivers/net/ethernet/mcs8140/nuport_mac.c
@@ -396,7 +396,7 @@ static void nuport_mac_adjust_link(struct net_device *dev)
priv->old_link = phydev->link;
}
- if (phydev->link & (priv->old_duplex != phydev->duplex)) {
+ if (phydev->link && (priv->old_duplex != phydev->duplex)) {
reg = nuport_mac_readl(CTRL_REG);
if (phydev->duplex == DUPLEX_FULL)
reg |= DUPLEX_FULL;
@@ -564,7 +564,6 @@ static int nuport_mac_rx(struct net_device *dev, int limit)
/* Get packet status */
status = get_unaligned((u32 *) (skb->data + len));
- skb->dev = dev;
dma_unmap_single(&priv->pdev->dev, priv->rx_addr, skb->len,
DMA_FROM_DEVICE);
@@ -615,6 +614,9 @@ static int nuport_mac_rx(struct net_device *dev, int limit)
exit:
skb = netdev_alloc_skb(dev, RX_ALLOC_SIZE);
+ if (!skb)
+ goto out;
+
skb_reserve(skb, RX_SKB_HEADROOM);
priv->rx_skb[priv->cur_rx] = skb;
priv->irq_rxskb[priv->cur_rx] = 1;
@@ -624,7 +626,7 @@ exit:
priv->cur_rx = 0;
count++;
}
-
+out:
return count;
}