diff options
author | Wei Yongjun <yongjun_wei@trendmicro.com.cn> | 2013-08-18 12:09:30 +0400 |
---|---|---|
committer | David S. Miller <davem@davemloft.net> | 2013-08-21 02:05:04 +0400 |
commit | 0aa857f83fe2674f973ad89ec7c0202f5c5d9554 (patch) | |
tree | 5c50ebf98f61473320dbdc086f0f421904472e2d /drivers/net/ethernet/moxa | |
parent | 2bc9ff01f1f93da6c36b34dbc7ce7c42f717693e (diff) | |
download | linux-0aa857f83fe2674f973ad89ec7c0202f5c5d9554.tar.xz |
moxa: fix missing unlock on error in moxart_mac_start_xmit()
Add the missing unlock before return from function moxart_mac_start_xmit()
in the error handling case.
Signed-off-by: Wei Yongjun <yongjun_wei@trendmicro.com.cn>
Signed-off-by: David S. Miller <davem@davemloft.net>
Diffstat (limited to 'drivers/net/ethernet/moxa')
-rw-r--r-- | drivers/net/ethernet/moxa/moxart_ether.c | 10 |
1 files changed, 6 insertions, 4 deletions
diff --git a/drivers/net/ethernet/moxa/moxart_ether.c b/drivers/net/ethernet/moxa/moxart_ether.c index abd2c545df83..6eee6863c224 100644 --- a/drivers/net/ethernet/moxa/moxart_ether.c +++ b/drivers/net/ethernet/moxa/moxart_ether.c @@ -314,6 +314,7 @@ static int moxart_mac_start_xmit(struct sk_buff *skb, struct net_device *ndev) unsigned int len; unsigned int tx_head = priv->tx_head; u32 txdes1; + int ret = NETDEV_TX_BUSY; desc = priv->tx_desc_base + (TX_REG_DESC_SIZE * tx_head); @@ -321,7 +322,7 @@ static int moxart_mac_start_xmit(struct sk_buff *skb, struct net_device *ndev) if (readl(desc + TX_REG_OFFSET_DESC0) & TX_DESC0_DMA_OWN) { net_dbg_ratelimited("no TX space for packet\n"); priv->stats.tx_dropped++; - return NETDEV_TX_BUSY; + goto out_unlock; } len = skb->len > TX_BUF_SIZE ? TX_BUF_SIZE : skb->len; @@ -330,7 +331,7 @@ static int moxart_mac_start_xmit(struct sk_buff *skb, struct net_device *ndev) len, DMA_TO_DEVICE); if (dma_mapping_error(&ndev->dev, priv->tx_mapping[tx_head])) { netdev_err(ndev, "DMA mapping error\n"); - return NETDEV_TX_BUSY; + goto out_unlock; } priv->tx_len[tx_head] = len; @@ -360,10 +361,11 @@ static int moxart_mac_start_xmit(struct sk_buff *skb, struct net_device *ndev) priv->tx_head = TX_NEXT(tx_head); ndev->trans_start = jiffies; - + ret = NETDEV_TX_OK; +out_unlock: spin_unlock_irq(&priv->txlock); - return NETDEV_TX_OK; + return ret; } static struct net_device_stats *moxart_mac_get_stats(struct net_device *ndev) |