aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/net
diff options
context:
space:
mode:
Diffstat (limited to 'drivers/net')
-rw-r--r--drivers/net/bonding/bond_main.c3
-rw-r--r--drivers/net/ethernet/broadcom/tg3.c36
-rw-r--r--drivers/net/ethernet/freescale/fec_main.c15
-rw-r--r--drivers/net/ethernet/marvell/mv643xx_eth.c2
-rw-r--r--drivers/net/ethernet/marvell/pxa168_eth.c4
-rw-r--r--drivers/net/ethernet/mellanox/mlx4/main.c3
-rw-r--r--drivers/net/ethernet/octeon/octeon_mgmt.c31
-rw-r--r--drivers/net/ethernet/qlogic/qlcnic/qlcnic_ctx.c2
-rw-r--r--drivers/net/ethernet/renesas/sh_eth.c38
-rw-r--r--drivers/net/ethernet/renesas/sh_eth.h2
-rw-r--r--drivers/net/ethernet/sfc/efx.c2
-rw-r--r--drivers/net/ethernet/stmicro/stmmac/common.h4
-rw-r--r--drivers/net/ethernet/stmicro/stmmac/stmmac_main.c66
-rw-r--r--drivers/net/ethernet/ti/cpsw.c3
-rw-r--r--drivers/net/ethernet/ti/davinci_cpdma.c7
-rw-r--r--drivers/net/macvtap.c6
-rw-r--r--drivers/net/tun.c6
-rw-r--r--drivers/net/usb/qmi_wwan.c8
-rw-r--r--drivers/net/wan/dlci.c26
19 files changed, 181 insertions, 83 deletions
diff --git a/drivers/net/bonding/bond_main.c b/drivers/net/bonding/bond_main.c
index 742c193881fa..07f257d44a1e 100644
--- a/drivers/net/bonding/bond_main.c
+++ b/drivers/net/bonding/bond_main.c
@@ -2364,7 +2364,8 @@ static void bond_miimon_commit(struct bonding *bond)
2364 2364
2365 pr_info("%s: link status definitely up for interface %s, %u Mbps %s duplex.\n", 2365 pr_info("%s: link status definitely up for interface %s, %u Mbps %s duplex.\n",
2366 bond->dev->name, slave->dev->name, 2366 bond->dev->name, slave->dev->name,
2367 slave->speed, slave->duplex ? "full" : "half"); 2367 slave->speed == SPEED_UNKNOWN ? 0 : slave->speed,
2368 slave->duplex ? "full" : "half");
2368 2369
2369 /* notify ad that the link status has changed */ 2370 /* notify ad that the link status has changed */
2370 if (bond->params.mode == BOND_MODE_8023AD) 2371 if (bond->params.mode == BOND_MODE_8023AD)
diff --git a/drivers/net/ethernet/broadcom/tg3.c b/drivers/net/ethernet/broadcom/tg3.c
index 986df04fdcb3..d964f302ac94 100644
--- a/drivers/net/ethernet/broadcom/tg3.c
+++ b/drivers/net/ethernet/broadcom/tg3.c
@@ -744,6 +744,9 @@ static int tg3_ape_lock(struct tg3 *tp, int locknum)
744 status = tg3_ape_read32(tp, gnt + off); 744 status = tg3_ape_read32(tp, gnt + off);
745 if (status == bit) 745 if (status == bit)
746 break; 746 break;
747 if (pci_channel_offline(tp->pdev))
748 break;
749
747 udelay(10); 750 udelay(10);
748 } 751 }
749 752
@@ -1632,6 +1635,9 @@ static void tg3_wait_for_event_ack(struct tg3 *tp)
1632 for (i = 0; i < delay_cnt; i++) { 1635 for (i = 0; i < delay_cnt; i++) {
1633 if (!(tr32(GRC_RX_CPU_EVENT) & GRC_RX_CPU_DRIVER_EVENT)) 1636 if (!(tr32(GRC_RX_CPU_EVENT) & GRC_RX_CPU_DRIVER_EVENT))
1634 break; 1637 break;
1638 if (pci_channel_offline(tp->pdev))
1639 break;
1640
1635 udelay(8); 1641 udelay(8);
1636 } 1642 }
1637} 1643}
@@ -1803,6 +1809,9 @@ static int tg3_poll_fw(struct tg3 *tp)
1803 for (i = 0; i < 200; i++) { 1809 for (i = 0; i < 200; i++) {
1804 if (tr32(VCPU_STATUS) & VCPU_STATUS_INIT_DONE) 1810 if (tr32(VCPU_STATUS) & VCPU_STATUS_INIT_DONE)
1805 return 0; 1811 return 0;
1812 if (pci_channel_offline(tp->pdev))
1813 return -ENODEV;
1814
1806 udelay(100); 1815 udelay(100);
1807 } 1816 }
1808 return -ENODEV; 1817 return -ENODEV;
@@ -1813,6 +1822,15 @@ static int tg3_poll_fw(struct tg3 *tp)
1813 tg3_read_mem(tp, NIC_SRAM_FIRMWARE_MBOX, &val); 1822 tg3_read_mem(tp, NIC_SRAM_FIRMWARE_MBOX, &val);
1814 if (val == ~NIC_SRAM_FIRMWARE_MBOX_MAGIC1) 1823 if (val == ~NIC_SRAM_FIRMWARE_MBOX_MAGIC1)
1815 break; 1824 break;
1825 if (pci_channel_offline(tp->pdev)) {
1826 if (!tg3_flag(tp, NO_FWARE_REPORTED)) {
1827 tg3_flag_set(tp, NO_FWARE_REPORTED);
1828 netdev_info(tp->dev, "No firmware running\n");
1829 }
1830
1831 break;
1832 }
1833
1816 udelay(10); 1834 udelay(10);
1817 } 1835 }
1818 1836
@@ -3547,6 +3565,8 @@ static int tg3_pause_cpu(struct tg3 *tp, u32 cpu_base)
3547 tw32(cpu_base + CPU_MODE, CPU_MODE_HALT); 3565 tw32(cpu_base + CPU_MODE, CPU_MODE_HALT);
3548 if (tr32(cpu_base + CPU_MODE) & CPU_MODE_HALT) 3566 if (tr32(cpu_base + CPU_MODE) & CPU_MODE_HALT)
3549 break; 3567 break;
3568 if (pci_channel_offline(tp->pdev))
3569 return -EBUSY;
3550 } 3570 }
3551 3571
3552 return (i == iters) ? -EBUSY : 0; 3572 return (i == iters) ? -EBUSY : 0;
@@ -8661,6 +8681,14 @@ static int tg3_stop_block(struct tg3 *tp, unsigned long ofs, u32 enable_bit, boo
8661 tw32_f(ofs, val); 8681 tw32_f(ofs, val);
8662 8682
8663 for (i = 0; i < MAX_WAIT_CNT; i++) { 8683 for (i = 0; i < MAX_WAIT_CNT; i++) {
8684 if (pci_channel_offline(tp->pdev)) {
8685 dev_err(&tp->pdev->dev,
8686 "tg3_stop_block device offline, "
8687 "ofs=%lx enable_bit=%x\n",
8688 ofs, enable_bit);
8689 return -ENODEV;
8690 }
8691
8664 udelay(100); 8692 udelay(100);
8665 val = tr32(ofs); 8693 val = tr32(ofs);
8666 if ((val & enable_bit) == 0) 8694 if ((val & enable_bit) == 0)
@@ -8684,6 +8712,13 @@ static int tg3_abort_hw(struct tg3 *tp, bool silent)
8684 8712
8685 tg3_disable_ints(tp); 8713 tg3_disable_ints(tp);
8686 8714
8715 if (pci_channel_offline(tp->pdev)) {
8716 tp->rx_mode &= ~(RX_MODE_ENABLE | TX_MODE_ENABLE);
8717 tp->mac_mode &= ~MAC_MODE_TDE_ENABLE;
8718 err = -ENODEV;
8719 goto err_no_dev;
8720 }
8721
8687 tp->rx_mode &= ~RX_MODE_ENABLE; 8722 tp->rx_mode &= ~RX_MODE_ENABLE;
8688 tw32_f(MAC_RX_MODE, tp->rx_mode); 8723 tw32_f(MAC_RX_MODE, tp->rx_mode);
8689 udelay(10); 8724 udelay(10);
@@ -8732,6 +8767,7 @@ static int tg3_abort_hw(struct tg3 *tp, bool silent)
8732 err |= tg3_stop_block(tp, BUFMGR_MODE, BUFMGR_MODE_ENABLE, silent); 8767 err |= tg3_stop_block(tp, BUFMGR_MODE, BUFMGR_MODE_ENABLE, silent);
8733 err |= tg3_stop_block(tp, MEMARB_MODE, MEMARB_MODE_ENABLE, silent); 8768 err |= tg3_stop_block(tp, MEMARB_MODE, MEMARB_MODE_ENABLE, silent);
8734 8769
8770err_no_dev:
8735 for (i = 0; i < tp->irq_cnt; i++) { 8771 for (i = 0; i < tp->irq_cnt; i++) {
8736 struct tg3_napi *tnapi = &tp->napi[i]; 8772 struct tg3_napi *tnapi = &tp->napi[i];
8737 if (tnapi->hw_status) 8773 if (tnapi->hw_status)
diff --git a/drivers/net/ethernet/freescale/fec_main.c b/drivers/net/ethernet/freescale/fec_main.c
index b6768821757b..1f7ff2268bd0 100644
--- a/drivers/net/ethernet/freescale/fec_main.c
+++ b/drivers/net/ethernet/freescale/fec_main.c
@@ -516,6 +516,7 @@ fec_restart(struct net_device *ndev, int duplex)
516 /* Set MII speed */ 516 /* Set MII speed */
517 writel(fep->phy_speed, fep->hwp + FEC_MII_SPEED); 517 writel(fep->phy_speed, fep->hwp + FEC_MII_SPEED);
518 518
519#if !defined(CONFIG_M5272)
519 /* set RX checksum */ 520 /* set RX checksum */
520 val = readl(fep->hwp + FEC_RACC); 521 val = readl(fep->hwp + FEC_RACC);
521 if (fep->csum_flags & FLAG_RX_CSUM_ENABLED) 522 if (fep->csum_flags & FLAG_RX_CSUM_ENABLED)
@@ -523,6 +524,7 @@ fec_restart(struct net_device *ndev, int duplex)
523 else 524 else
524 val &= ~FEC_RACC_OPTIONS; 525 val &= ~FEC_RACC_OPTIONS;
525 writel(val, fep->hwp + FEC_RACC); 526 writel(val, fep->hwp + FEC_RACC);
527#endif
526 528
527 /* 529 /*
528 * The phy interface and speed need to get configured 530 * The phy interface and speed need to get configured
@@ -575,6 +577,7 @@ fec_restart(struct net_device *ndev, int duplex)
575#endif 577#endif
576 } 578 }
577 579
580#if !defined(CONFIG_M5272)
578 /* enable pause frame*/ 581 /* enable pause frame*/
579 if ((fep->pause_flag & FEC_PAUSE_FLAG_ENABLE) || 582 if ((fep->pause_flag & FEC_PAUSE_FLAG_ENABLE) ||
580 ((fep->pause_flag & FEC_PAUSE_FLAG_AUTONEG) && 583 ((fep->pause_flag & FEC_PAUSE_FLAG_AUTONEG) &&
@@ -592,6 +595,7 @@ fec_restart(struct net_device *ndev, int duplex)
592 } else { 595 } else {
593 rcntl &= ~FEC_ENET_FCE; 596 rcntl &= ~FEC_ENET_FCE;
594 } 597 }
598#endif /* !defined(CONFIG_M5272) */
595 599
596 writel(rcntl, fep->hwp + FEC_R_CNTRL); 600 writel(rcntl, fep->hwp + FEC_R_CNTRL);
597 601
@@ -1211,7 +1215,9 @@ static int fec_enet_mii_probe(struct net_device *ndev)
1211 /* mask with MAC supported features */ 1215 /* mask with MAC supported features */
1212 if (id_entry->driver_data & FEC_QUIRK_HAS_GBIT) { 1216 if (id_entry->driver_data & FEC_QUIRK_HAS_GBIT) {
1213 phy_dev->supported &= PHY_GBIT_FEATURES; 1217 phy_dev->supported &= PHY_GBIT_FEATURES;
1218#if !defined(CONFIG_M5272)
1214 phy_dev->supported |= SUPPORTED_Pause; 1219 phy_dev->supported |= SUPPORTED_Pause;
1220#endif
1215 } 1221 }
1216 else 1222 else
1217 phy_dev->supported &= PHY_BASIC_FEATURES; 1223 phy_dev->supported &= PHY_BASIC_FEATURES;
@@ -1396,6 +1402,8 @@ static int fec_enet_get_ts_info(struct net_device *ndev,
1396 } 1402 }
1397} 1403}
1398 1404
1405#if !defined(CONFIG_M5272)
1406
1399static void fec_enet_get_pauseparam(struct net_device *ndev, 1407static void fec_enet_get_pauseparam(struct net_device *ndev,
1400 struct ethtool_pauseparam *pause) 1408 struct ethtool_pauseparam *pause)
1401{ 1409{
@@ -1442,7 +1450,6 @@ static int fec_enet_set_pauseparam(struct net_device *ndev,
1442 return 0; 1450 return 0;
1443} 1451}
1444 1452
1445#ifndef CONFIG_M5272
1446static const struct fec_stat { 1453static const struct fec_stat {
1447 char name[ETH_GSTRING_LEN]; 1454 char name[ETH_GSTRING_LEN];
1448 u16 offset; 1455 u16 offset;
@@ -1541,7 +1548,7 @@ static int fec_enet_get_sset_count(struct net_device *dev, int sset)
1541 return -EOPNOTSUPP; 1548 return -EOPNOTSUPP;
1542 } 1549 }
1543} 1550}
1544#endif 1551#endif /* !defined(CONFIG_M5272) */
1545 1552
1546static int fec_enet_nway_reset(struct net_device *dev) 1553static int fec_enet_nway_reset(struct net_device *dev)
1547{ 1554{
@@ -1555,8 +1562,10 @@ static int fec_enet_nway_reset(struct net_device *dev)
1555} 1562}
1556 1563
1557static const struct ethtool_ops fec_enet_ethtool_ops = { 1564static const struct ethtool_ops fec_enet_ethtool_ops = {
1565#if !defined(CONFIG_M5272)
1558 .get_pauseparam = fec_enet_get_pauseparam, 1566 .get_pauseparam = fec_enet_get_pauseparam,
1559 .set_pauseparam = fec_enet_set_pauseparam, 1567 .set_pauseparam = fec_enet_set_pauseparam,
1568#endif
1560 .get_settings = fec_enet_get_settings, 1569 .get_settings = fec_enet_get_settings,
1561 .set_settings = fec_enet_set_settings, 1570 .set_settings = fec_enet_set_settings,
1562 .get_drvinfo = fec_enet_get_drvinfo, 1571 .get_drvinfo = fec_enet_get_drvinfo,
@@ -1996,10 +2005,12 @@ fec_probe(struct platform_device *pdev)
1996 /* setup board info structure */ 2005 /* setup board info structure */
1997 fep = netdev_priv(ndev); 2006 fep = netdev_priv(ndev);
1998 2007
2008#if !defined(CONFIG_M5272)
1999 /* default enable pause frame auto negotiation */ 2009 /* default enable pause frame auto negotiation */
2000 if (pdev->id_entry && 2010 if (pdev->id_entry &&
2001 (pdev->id_entry->driver_data & FEC_QUIRK_HAS_GBIT)) 2011 (pdev->id_entry->driver_data & FEC_QUIRK_HAS_GBIT))
2002 fep->pause_flag |= FEC_PAUSE_FLAG_AUTONEG; 2012 fep->pause_flag |= FEC_PAUSE_FLAG_AUTONEG;
2013#endif
2003 2014
2004 fep->hwp = devm_ioremap_resource(&pdev->dev, r); 2015 fep->hwp = devm_ioremap_resource(&pdev->dev, r);
2005 if (IS_ERR(fep->hwp)) { 2016 if (IS_ERR(fep->hwp)) {
diff --git a/drivers/net/ethernet/marvell/mv643xx_eth.c b/drivers/net/ethernet/marvell/mv643xx_eth.c
index 510d50603a02..6495bea56ec8 100644
--- a/drivers/net/ethernet/marvell/mv643xx_eth.c
+++ b/drivers/net/ethernet/marvell/mv643xx_eth.c
@@ -1763,7 +1763,7 @@ static int rxq_init(struct mv643xx_eth_private *mp, int index)
1763 memset(rxq->rx_desc_area, 0, size); 1763 memset(rxq->rx_desc_area, 0, size);
1764 1764
1765 rxq->rx_desc_area_size = size; 1765 rxq->rx_desc_area_size = size;
1766 rxq->rx_skb = kmalloc_array(rxq->rx_ring_size, sizeof(*rxq->rx_skb), 1766 rxq->rx_skb = kcalloc(rxq->rx_ring_size, sizeof(*rxq->rx_skb),
1767 GFP_KERNEL); 1767 GFP_KERNEL);
1768 if (rxq->rx_skb == NULL) 1768 if (rxq->rx_skb == NULL)
1769 goto out_free; 1769 goto out_free;
diff --git a/drivers/net/ethernet/marvell/pxa168_eth.c b/drivers/net/ethernet/marvell/pxa168_eth.c
index ec20508f0d6b..db481477bcc5 100644
--- a/drivers/net/ethernet/marvell/pxa168_eth.c
+++ b/drivers/net/ethernet/marvell/pxa168_eth.c
@@ -1015,7 +1015,7 @@ static int rxq_init(struct net_device *dev)
1015 int rx_desc_num = pep->rx_ring_size; 1015 int rx_desc_num = pep->rx_ring_size;
1016 1016
1017 /* Allocate RX skb rings */ 1017 /* Allocate RX skb rings */
1018 pep->rx_skb = kmalloc(sizeof(*pep->rx_skb) * pep->rx_ring_size, 1018 pep->rx_skb = kzalloc(sizeof(*pep->rx_skb) * pep->rx_ring_size,
1019 GFP_KERNEL); 1019 GFP_KERNEL);
1020 if (!pep->rx_skb) 1020 if (!pep->rx_skb)
1021 return -ENOMEM; 1021 return -ENOMEM;
@@ -1076,7 +1076,7 @@ static int txq_init(struct net_device *dev)
1076 int size = 0, i = 0; 1076 int size = 0, i = 0;
1077 int tx_desc_num = pep->tx_ring_size; 1077 int tx_desc_num = pep->tx_ring_size;
1078 1078
1079 pep->tx_skb = kmalloc(sizeof(*pep->tx_skb) * pep->tx_ring_size, 1079 pep->tx_skb = kzalloc(sizeof(*pep->tx_skb) * pep->tx_ring_size,
1080 GFP_KERNEL); 1080 GFP_KERNEL);
1081 if (!pep->tx_skb) 1081 if (!pep->tx_skb)
1082 return -ENOMEM; 1082 return -ENOMEM;
diff --git a/drivers/net/ethernet/mellanox/mlx4/main.c b/drivers/net/ethernet/mellanox/mlx4/main.c
index 56160a2bb57b..f390785417f0 100644
--- a/drivers/net/ethernet/mellanox/mlx4/main.c
+++ b/drivers/net/ethernet/mellanox/mlx4/main.c
@@ -632,6 +632,9 @@ static int mlx4_slave_cap(struct mlx4_dev *dev)
632 dev->caps.cqe_size = 32; 632 dev->caps.cqe_size = 32;
633 } 633 }
634 634
635 dev->caps.flags2 &= ~MLX4_DEV_CAP_FLAG2_TS;
636 mlx4_warn(dev, "Timestamping is not supported in slave mode.\n");
637
635 slave_adjust_steering_mode(dev, &dev_cap, &hca_param); 638 slave_adjust_steering_mode(dev, &dev_cap, &hca_param);
636 639
637 return 0; 640 return 0;
diff --git a/drivers/net/ethernet/octeon/octeon_mgmt.c b/drivers/net/ethernet/octeon/octeon_mgmt.c
index e6e029237a63..622aa75904c4 100644
--- a/drivers/net/ethernet/octeon/octeon_mgmt.c
+++ b/drivers/net/ethernet/octeon/octeon_mgmt.c
@@ -46,17 +46,25 @@
46union mgmt_port_ring_entry { 46union mgmt_port_ring_entry {
47 u64 d64; 47 u64 d64;
48 struct { 48 struct {
49 u64 reserved_62_63:2; 49#define RING_ENTRY_CODE_DONE 0xf
50#define RING_ENTRY_CODE_MORE 0x10
51#ifdef __BIG_ENDIAN_BITFIELD
52 u64 reserved_62_63:2;
50 /* Length of the buffer/packet in bytes */ 53 /* Length of the buffer/packet in bytes */
51 u64 len:14; 54 u64 len:14;
52 /* For TX, signals that the packet should be timestamped */ 55 /* For TX, signals that the packet should be timestamped */
53 u64 tstamp:1; 56 u64 tstamp:1;
54 /* The RX error code */ 57 /* The RX error code */
55 u64 code:7; 58 u64 code:7;
56#define RING_ENTRY_CODE_DONE 0xf
57#define RING_ENTRY_CODE_MORE 0x10
58 /* Physical address of the buffer */ 59 /* Physical address of the buffer */
59 u64 addr:40; 60 u64 addr:40;
61#else
62 u64 addr:40;
63 u64 code:7;
64 u64 tstamp:1;
65 u64 len:14;
66 u64 reserved_62_63:2;
67#endif
60 } s; 68 } s;
61}; 69};
62 70
@@ -1141,10 +1149,13 @@ static int octeon_mgmt_open(struct net_device *netdev)
1141 /* For compensation state to lock. */ 1149 /* For compensation state to lock. */
1142 ndelay(1040 * NS_PER_PHY_CLK); 1150 ndelay(1040 * NS_PER_PHY_CLK);
1143 1151
1144 /* Some Ethernet switches cannot handle standard 1152 /* Default Interframe Gaps are too small. Recommended
1145 * Interframe Gap, increase to 16 bytes. 1153 * workaround is.
1154 *
1155 * AGL_GMX_TX_IFG[IFG1]=14
1156 * AGL_GMX_TX_IFG[IFG2]=10
1146 */ 1157 */
1147 cvmx_write_csr(CVMX_AGL_GMX_TX_IFG, 0x88); 1158 cvmx_write_csr(CVMX_AGL_GMX_TX_IFG, 0xae);
1148 } 1159 }
1149 1160
1150 octeon_mgmt_rx_fill_ring(netdev); 1161 octeon_mgmt_rx_fill_ring(netdev);
diff --git a/drivers/net/ethernet/qlogic/qlcnic/qlcnic_ctx.c b/drivers/net/ethernet/qlogic/qlcnic/qlcnic_ctx.c
index 0d54fceda960..0581a484ceb5 100644
--- a/drivers/net/ethernet/qlogic/qlcnic/qlcnic_ctx.c
+++ b/drivers/net/ethernet/qlogic/qlcnic/qlcnic_ctx.c
@@ -665,7 +665,7 @@ void qlcnic_fw_destroy_ctx(struct qlcnic_adapter *adapter)
665 qlcnic_83xx_config_intrpt(adapter, 0); 665 qlcnic_83xx_config_intrpt(adapter, 0);
666 } 666 }
667 /* Allow dma queues to drain after context reset */ 667 /* Allow dma queues to drain after context reset */
668 msleep(20); 668 mdelay(20);
669 } 669 }
670} 670}
671 671
diff --git a/drivers/net/ethernet/renesas/sh_eth.c b/drivers/net/ethernet/renesas/sh_eth.c
index 7732f11f14ad..a753928bab9c 100644
--- a/drivers/net/ethernet/renesas/sh_eth.c
+++ b/drivers/net/ethernet/renesas/sh_eth.c
@@ -382,8 +382,9 @@ static struct sh_eth_cpu_data r8a777x_data = {
382 .eesipr_value = 0x01ff009f, 382 .eesipr_value = 0x01ff009f,
383 383
384 .tx_check = EESR_FTC | EESR_CND | EESR_DLC | EESR_CD | EESR_RTO, 384 .tx_check = EESR_FTC | EESR_CND | EESR_DLC | EESR_CD | EESR_RTO,
385 .eesr_err_check = EESR_TWB | EESR_TABT | EESR_RABT | EESR_RDE | 385 .eesr_err_check = EESR_TWB | EESR_TABT | EESR_RABT | EESR_RFE |
386 EESR_RFRMER | EESR_TFE | EESR_TDE | EESR_ECI, 386 EESR_RDE | EESR_RFRMER | EESR_TFE | EESR_TDE |
387 EESR_ECI,
387 388
388 .apr = 1, 389 .apr = 1,
389 .mpr = 1, 390 .mpr = 1,
@@ -417,8 +418,9 @@ static struct sh_eth_cpu_data sh7724_data = {
417 .eesipr_value = 0x01ff009f, 418 .eesipr_value = 0x01ff009f,
418 419
419 .tx_check = EESR_FTC | EESR_CND | EESR_DLC | EESR_CD | EESR_RTO, 420 .tx_check = EESR_FTC | EESR_CND | EESR_DLC | EESR_CD | EESR_RTO,
420 .eesr_err_check = EESR_TWB | EESR_TABT | EESR_RABT | EESR_RDE | 421 .eesr_err_check = EESR_TWB | EESR_TABT | EESR_RABT | EESR_RFE |
421 EESR_RFRMER | EESR_TFE | EESR_TDE | EESR_ECI, 422 EESR_RDE | EESR_RFRMER | EESR_TFE | EESR_TDE |
423 EESR_ECI,
422 424
423 .apr = 1, 425 .apr = 1,
424 .mpr = 1, 426 .mpr = 1,
@@ -453,8 +455,9 @@ static struct sh_eth_cpu_data sh7757_data = {
453 .rmcr_value = 0x00000001, 455 .rmcr_value = 0x00000001,
454 456
455 .tx_check = EESR_FTC | EESR_CND | EESR_DLC | EESR_CD | EESR_RTO, 457 .tx_check = EESR_FTC | EESR_CND | EESR_DLC | EESR_CD | EESR_RTO,
456 .eesr_err_check = EESR_TWB | EESR_TABT | EESR_RABT | EESR_RDE | 458 .eesr_err_check = EESR_TWB | EESR_TABT | EESR_RABT | EESR_RFE |
457 EESR_RFRMER | EESR_TFE | EESR_TDE | EESR_ECI, 459 EESR_RDE | EESR_RFRMER | EESR_TFE | EESR_TDE |
460 EESR_ECI,
458 461
459 .irq_flags = IRQF_SHARED, 462 .irq_flags = IRQF_SHARED,
460 .apr = 1, 463 .apr = 1,
@@ -521,9 +524,9 @@ static struct sh_eth_cpu_data sh7757_data_giga = {
521 .eesipr_value = DMAC_M_RFRMER | DMAC_M_ECI | 0x003fffff, 524 .eesipr_value = DMAC_M_RFRMER | DMAC_M_ECI | 0x003fffff,
522 525
523 .tx_check = EESR_TC1 | EESR_FTC, 526 .tx_check = EESR_TC1 | EESR_FTC,
524 .eesr_err_check = EESR_TWB1 | EESR_TWB | EESR_TABT | EESR_RABT | \ 527 .eesr_err_check = EESR_TWB1 | EESR_TWB | EESR_TABT | EESR_RABT |
525 EESR_RDE | EESR_RFRMER | EESR_TFE | EESR_TDE | \ 528 EESR_RFE | EESR_RDE | EESR_RFRMER | EESR_TFE |
526 EESR_ECI, 529 EESR_TDE | EESR_ECI,
527 .fdr_value = 0x0000072f, 530 .fdr_value = 0x0000072f,
528 .rmcr_value = 0x00000001, 531 .rmcr_value = 0x00000001,
529 532
@@ -579,9 +582,9 @@ static struct sh_eth_cpu_data sh7734_data = {
579 .eesipr_value = DMAC_M_RFRMER | DMAC_M_ECI | 0x003fffff, 582 .eesipr_value = DMAC_M_RFRMER | DMAC_M_ECI | 0x003fffff,
580 583
581 .tx_check = EESR_TC1 | EESR_FTC, 584 .tx_check = EESR_TC1 | EESR_FTC,
582 .eesr_err_check = EESR_TWB1 | EESR_TWB | EESR_TABT | EESR_RABT | \ 585 .eesr_err_check = EESR_TWB1 | EESR_TWB | EESR_TABT | EESR_RABT |
583 EESR_RDE | EESR_RFRMER | EESR_TFE | EESR_TDE | \ 586 EESR_RFE | EESR_RDE | EESR_RFRMER | EESR_TFE |
584 EESR_ECI, 587 EESR_TDE | EESR_ECI,
585 588
586 .apr = 1, 589 .apr = 1,
587 .mpr = 1, 590 .mpr = 1,
@@ -643,9 +646,9 @@ static struct sh_eth_cpu_data r8a7740_data = {
643 .eesipr_value = DMAC_M_RFRMER | DMAC_M_ECI | 0x003fffff, 646 .eesipr_value = DMAC_M_RFRMER | DMAC_M_ECI | 0x003fffff,
644 647
645 .tx_check = EESR_TC1 | EESR_FTC, 648 .tx_check = EESR_TC1 | EESR_FTC,
646 .eesr_err_check = EESR_TWB1 | EESR_TWB | EESR_TABT | EESR_RABT | \ 649 .eesr_err_check = EESR_TWB1 | EESR_TWB | EESR_TABT | EESR_RABT |
647 EESR_RDE | EESR_RFRMER | EESR_TFE | EESR_TDE | \ 650 EESR_RFE | EESR_RDE | EESR_RFRMER | EESR_TFE |
648 EESR_ECI, 651 EESR_TDE | EESR_ECI,
649 652
650 .apr = 1, 653 .apr = 1,
651 .mpr = 1, 654 .mpr = 1,
@@ -1401,11 +1404,12 @@ static void sh_eth_error(struct net_device *ndev, int intr_status)
1401 1404
1402ignore_link: 1405ignore_link:
1403 if (intr_status & EESR_TWB) { 1406 if (intr_status & EESR_TWB) {
1404 /* Write buck end. unused write back interrupt */ 1407 /* Unused write back interrupt */
1405 if (intr_status & EESR_TABT) /* Transmit Abort int */ 1408 if (intr_status & EESR_TABT) { /* Transmit Abort int */
1406 ndev->stats.tx_aborted_errors++; 1409 ndev->stats.tx_aborted_errors++;
1407 if (netif_msg_tx_err(mdp)) 1410 if (netif_msg_tx_err(mdp))
1408 dev_err(&ndev->dev, "Transmit Abort\n"); 1411 dev_err(&ndev->dev, "Transmit Abort\n");
1412 }
1409 } 1413 }
1410 1414
1411 if (intr_status & EESR_RABT) { 1415 if (intr_status & EESR_RABT) {
diff --git a/drivers/net/ethernet/renesas/sh_eth.h b/drivers/net/ethernet/renesas/sh_eth.h
index a78fb0c424f8..99995bf38c40 100644
--- a/drivers/net/ethernet/renesas/sh_eth.h
+++ b/drivers/net/ethernet/renesas/sh_eth.h
@@ -258,7 +258,7 @@ enum EESR_BIT {
258 258
259#define DEFAULT_TX_CHECK (EESR_FTC | EESR_CND | EESR_DLC | EESR_CD | \ 259#define DEFAULT_TX_CHECK (EESR_FTC | EESR_CND | EESR_DLC | EESR_CD | \
260 EESR_RTO) 260 EESR_RTO)
261#define DEFAULT_EESR_ERR_CHECK (EESR_TWB | EESR_TABT | EESR_RABT | \ 261#define DEFAULT_EESR_ERR_CHECK (EESR_TWB | EESR_TABT | EESR_RABT | EESR_RFE | \
262 EESR_RDE | EESR_RFRMER | EESR_ADE | \ 262 EESR_RDE | EESR_RFRMER | EESR_ADE | \
263 EESR_TFE | EESR_TDE | EESR_ECI) 263 EESR_TFE | EESR_TDE | EESR_ECI)
264 264
diff --git a/drivers/net/ethernet/sfc/efx.c b/drivers/net/ethernet/sfc/efx.c
index e7284a2caffa..c72968840f1a 100644
--- a/drivers/net/ethernet/sfc/efx.c
+++ b/drivers/net/ethernet/sfc/efx.c
@@ -2115,7 +2115,7 @@ show_phy_type(struct device *dev, struct device_attribute *attr, char *buf)
2115 struct efx_nic *efx = pci_get_drvdata(to_pci_dev(dev)); 2115 struct efx_nic *efx = pci_get_drvdata(to_pci_dev(dev));
2116 return sprintf(buf, "%d\n", efx->phy_type); 2116 return sprintf(buf, "%d\n", efx->phy_type);
2117} 2117}
2118static DEVICE_ATTR(phy_type, 0644, show_phy_type, NULL); 2118static DEVICE_ATTR(phy_type, 0444, show_phy_type, NULL);
2119 2119
2120static int efx_register_netdev(struct efx_nic *efx) 2120static int efx_register_netdev(struct efx_nic *efx)
2121{ 2121{
diff --git a/drivers/net/ethernet/stmicro/stmmac/common.h b/drivers/net/ethernet/stmicro/stmmac/common.h
index 9911b9323f00..7eb8babed2cb 100644
--- a/drivers/net/ethernet/stmicro/stmmac/common.h
+++ b/drivers/net/ethernet/stmicro/stmmac/common.h
@@ -287,8 +287,8 @@ struct dma_features {
287#define MAC_RNABLE_RX 0x00000004 /* Receiver Enable */ 287#define MAC_RNABLE_RX 0x00000004 /* Receiver Enable */
288 288
289/* Default LPI timers */ 289/* Default LPI timers */
290#define STMMAC_DEFAULT_LIT_LS_TIMER 0x3E8 290#define STMMAC_DEFAULT_LIT_LS 0x3E8
291#define STMMAC_DEFAULT_TWT_LS_TIMER 0x0 291#define STMMAC_DEFAULT_TWT_LS 0x0
292 292
293#define STMMAC_CHAIN_MODE 0x1 293#define STMMAC_CHAIN_MODE 0x1
294#define STMMAC_RING_MODE 0x2 294#define STMMAC_RING_MODE 0x2
diff --git a/drivers/net/ethernet/stmicro/stmmac/stmmac_main.c b/drivers/net/ethernet/stmicro/stmmac/stmmac_main.c
index 62e31054bd24..f2d283d2528f 100644
--- a/drivers/net/ethernet/stmicro/stmmac/stmmac_main.c
+++ b/drivers/net/ethernet/stmicro/stmmac/stmmac_main.c
@@ -104,7 +104,7 @@ static const u32 default_msg_level = (NETIF_MSG_DRV | NETIF_MSG_PROBE |
104static int eee_timer = STMMAC_DEFAULT_LPI_TIMER; 104static int eee_timer = STMMAC_DEFAULT_LPI_TIMER;
105module_param(eee_timer, int, S_IRUGO | S_IWUSR); 105module_param(eee_timer, int, S_IRUGO | S_IWUSR);
106MODULE_PARM_DESC(eee_timer, "LPI tx expiration time in msec"); 106MODULE_PARM_DESC(eee_timer, "LPI tx expiration time in msec");
107#define STMMAC_LPI_TIMER(x) (jiffies + msecs_to_jiffies(x)) 107#define STMMAC_LPI_T(x) (jiffies + msecs_to_jiffies(x))
108 108
109/* By default the driver will use the ring mode to manage tx and rx descriptors 109/* By default the driver will use the ring mode to manage tx and rx descriptors
110 * but passing this value so user can force to use the chain instead of the ring 110 * but passing this value so user can force to use the chain instead of the ring
@@ -260,7 +260,7 @@ static void stmmac_eee_ctrl_timer(unsigned long arg)
260 struct stmmac_priv *priv = (struct stmmac_priv *)arg; 260 struct stmmac_priv *priv = (struct stmmac_priv *)arg;
261 261
262 stmmac_enable_eee_mode(priv); 262 stmmac_enable_eee_mode(priv);
263 mod_timer(&priv->eee_ctrl_timer, STMMAC_LPI_TIMER(eee_timer)); 263 mod_timer(&priv->eee_ctrl_timer, STMMAC_LPI_T(eee_timer));
264} 264}
265 265
266/** 266/**
@@ -276,22 +276,34 @@ bool stmmac_eee_init(struct stmmac_priv *priv)
276{ 276{
277 bool ret = false; 277 bool ret = false;
278 278
279 /* Using PCS we cannot dial with the phy registers at this stage
280 * so we do not support extra feature like EEE.
281 */
282 if ((priv->pcs == STMMAC_PCS_RGMII) || (priv->pcs == STMMAC_PCS_TBI) ||
283 (priv->pcs == STMMAC_PCS_RTBI))
284 goto out;
285
279 /* MAC core supports the EEE feature. */ 286 /* MAC core supports the EEE feature. */
280 if (priv->dma_cap.eee) { 287 if (priv->dma_cap.eee) {
281 /* Check if the PHY supports EEE */ 288 /* Check if the PHY supports EEE */
282 if (phy_init_eee(priv->phydev, 1)) 289 if (phy_init_eee(priv->phydev, 1))
283 goto out; 290 goto out;
284 291
285 priv->eee_active = 1; 292 if (!priv->eee_active) {
286 init_timer(&priv->eee_ctrl_timer); 293 priv->eee_active = 1;
287 priv->eee_ctrl_timer.function = stmmac_eee_ctrl_timer; 294 init_timer(&priv->eee_ctrl_timer);
288 priv->eee_ctrl_timer.data = (unsigned long)priv; 295 priv->eee_ctrl_timer.function = stmmac_eee_ctrl_timer;
289 priv->eee_ctrl_timer.expires = STMMAC_LPI_TIMER(eee_timer); 296 priv->eee_ctrl_timer.data = (unsigned long)priv;
290 add_timer(&priv->eee_ctrl_timer); 297 priv->eee_ctrl_timer.expires = STMMAC_LPI_T(eee_timer);
291 298 add_timer(&priv->eee_ctrl_timer);
292 priv->hw->mac->set_eee_timer(priv->ioaddr, 299
293 STMMAC_DEFAULT_LIT_LS_TIMER, 300 priv->hw->mac->set_eee_timer(priv->ioaddr,
294 priv->tx_lpi_timer); 301 STMMAC_DEFAULT_LIT_LS,
302 priv->tx_lpi_timer);
303 } else
304 /* Set HW EEE according to the speed */
305 priv->hw->mac->set_eee_pls(priv->ioaddr,
306 priv->phydev->link);
295 307
296 pr_info("stmmac: Energy-Efficient Ethernet initialized\n"); 308 pr_info("stmmac: Energy-Efficient Ethernet initialized\n");
297 309
@@ -301,20 +313,6 @@ out:
301 return ret; 313 return ret;
302} 314}
303 315
304/**
305 * stmmac_eee_adjust: adjust HW EEE according to the speed
306 * @priv: driver private structure
307 * Description:
308 * When the EEE has been already initialised we have to
309 * modify the PLS bit in the LPI ctrl & status reg according
310 * to the PHY link status. For this reason.
311 */
312static void stmmac_eee_adjust(struct stmmac_priv *priv)
313{
314 if (priv->eee_enabled)
315 priv->hw->mac->set_eee_pls(priv->ioaddr, priv->phydev->link);
316}
317
318/* stmmac_get_tx_hwtstamp: get HW TX timestamps 316/* stmmac_get_tx_hwtstamp: get HW TX timestamps
319 * @priv: driver private structure 317 * @priv: driver private structure
320 * @entry : descriptor index to be used. 318 * @entry : descriptor index to be used.
@@ -738,7 +736,10 @@ static void stmmac_adjust_link(struct net_device *dev)
738 if (new_state && netif_msg_link(priv)) 736 if (new_state && netif_msg_link(priv))
739 phy_print_status(phydev); 737 phy_print_status(phydev);
740 738
741 stmmac_eee_adjust(priv); 739 /* At this stage, it could be needed to setup the EEE or adjust some
740 * MAC related HW registers.
741 */
742 priv->eee_enabled = stmmac_eee_init(priv);
742 743
743 spin_unlock_irqrestore(&priv->lock, flags); 744 spin_unlock_irqrestore(&priv->lock, flags);
744} 745}
@@ -1250,7 +1251,7 @@ static void stmmac_tx_clean(struct stmmac_priv *priv)
1250 1251
1251 if ((priv->eee_enabled) && (!priv->tx_path_in_lpi_mode)) { 1252 if ((priv->eee_enabled) && (!priv->tx_path_in_lpi_mode)) {
1252 stmmac_enable_eee_mode(priv); 1253 stmmac_enable_eee_mode(priv);
1253 mod_timer(&priv->eee_ctrl_timer, STMMAC_LPI_TIMER(eee_timer)); 1254 mod_timer(&priv->eee_ctrl_timer, STMMAC_LPI_T(eee_timer));
1254 } 1255 }
1255 spin_unlock(&priv->tx_lock); 1256 spin_unlock(&priv->tx_lock);
1256} 1257}
@@ -1644,14 +1645,9 @@ static int stmmac_open(struct net_device *dev)
1644 if (priv->phydev) 1645 if (priv->phydev)
1645 phy_start(priv->phydev); 1646 phy_start(priv->phydev);
1646 1647
1647 priv->tx_lpi_timer = STMMAC_DEFAULT_TWT_LS_TIMER; 1648 priv->tx_lpi_timer = STMMAC_DEFAULT_TWT_LS;
1648 1649
1649 /* Using PCS we cannot dial with the phy registers at this stage 1650 priv->eee_enabled = stmmac_eee_init(priv);
1650 * so we do not support extra feature like EEE.
1651 */
1652 if (priv->pcs != STMMAC_PCS_RGMII && priv->pcs != STMMAC_PCS_TBI &&
1653 priv->pcs != STMMAC_PCS_RTBI)
1654 priv->eee_enabled = stmmac_eee_init(priv);
1655 1651
1656 stmmac_init_tx_coalesce(priv); 1652 stmmac_init_tx_coalesce(priv);
1657 1653
diff --git a/drivers/net/ethernet/ti/cpsw.c b/drivers/net/ethernet/ti/cpsw.c
index 2c3657adc7cb..ab48cef9e5a9 100644
--- a/drivers/net/ethernet/ti/cpsw.c
+++ b/drivers/net/ethernet/ti/cpsw.c
@@ -1974,9 +1974,12 @@ static int cpsw_suspend(struct device *dev)
1974{ 1974{
1975 struct platform_device *pdev = to_platform_device(dev); 1975 struct platform_device *pdev = to_platform_device(dev);
1976 struct net_device *ndev = platform_get_drvdata(pdev); 1976 struct net_device *ndev = platform_get_drvdata(pdev);
1977 struct cpsw_priv *priv = netdev_priv(ndev);
1977 1978
1978 if (netif_running(ndev)) 1979 if (netif_running(ndev))
1979 cpsw_ndo_stop(ndev); 1980 cpsw_ndo_stop(ndev);
1981 soft_reset("sliver 0", &priv->slaves[0].sliver->soft_reset);
1982 soft_reset("sliver 1", &priv->slaves[1].sliver->soft_reset);
1980 pm_runtime_put_sync(&pdev->dev); 1983 pm_runtime_put_sync(&pdev->dev);
1981 1984
1982 return 0; 1985 return 0;
diff --git a/drivers/net/ethernet/ti/davinci_cpdma.c b/drivers/net/ethernet/ti/davinci_cpdma.c
index a377bc727740..031ebc81b50c 100644
--- a/drivers/net/ethernet/ti/davinci_cpdma.c
+++ b/drivers/net/ethernet/ti/davinci_cpdma.c
@@ -706,6 +706,13 @@ int cpdma_chan_submit(struct cpdma_chan *chan, void *token, void *data,
706 } 706 }
707 707
708 buffer = dma_map_single(ctlr->dev, data, len, chan->dir); 708 buffer = dma_map_single(ctlr->dev, data, len, chan->dir);
709 ret = dma_mapping_error(ctlr->dev, buffer);
710 if (ret) {
711 cpdma_desc_free(ctlr->pool, desc, 1);
712 ret = -EINVAL;
713 goto unlock_ret;
714 }
715
709 mode = CPDMA_DESC_OWNER | CPDMA_DESC_SOP | CPDMA_DESC_EOP; 716 mode = CPDMA_DESC_OWNER | CPDMA_DESC_SOP | CPDMA_DESC_EOP;
710 cpdma_desc_to_port(chan, mode, directed); 717 cpdma_desc_to_port(chan, mode, directed);
711 718
diff --git a/drivers/net/macvtap.c b/drivers/net/macvtap.c
index 5bfaecdd2354..f2c4a3b218fc 100644
--- a/drivers/net/macvtap.c
+++ b/drivers/net/macvtap.c
@@ -589,8 +589,10 @@ static int zerocopy_sg_from_iovec(struct sk_buff *skb, const struct iovec *from,
589 return -EMSGSIZE; 589 return -EMSGSIZE;
590 num_pages = get_user_pages_fast(base, size, 0, &page[i]); 590 num_pages = get_user_pages_fast(base, size, 0, &page[i]);
591 if (num_pages != size) { 591 if (num_pages != size) {
592 for (i = 0; i < num_pages; i++) 592 int j;
593 put_page(page[i]); 593
594 for (j = 0; j < num_pages; j++)
595 put_page(page[i + j]);
594 return -EFAULT; 596 return -EFAULT;
595 } 597 }
596 truesize = size * PAGE_SIZE; 598 truesize = size * PAGE_SIZE;
diff --git a/drivers/net/tun.c b/drivers/net/tun.c
index cea2fe4e9812..7eab5fcd064f 100644
--- a/drivers/net/tun.c
+++ b/drivers/net/tun.c
@@ -1008,8 +1008,10 @@ static int zerocopy_sg_from_iovec(struct sk_buff *skb, const struct iovec *from,
1008 return -EMSGSIZE; 1008 return -EMSGSIZE;
1009 num_pages = get_user_pages_fast(base, size, 0, &page[i]); 1009 num_pages = get_user_pages_fast(base, size, 0, &page[i]);
1010 if (num_pages != size) { 1010 if (num_pages != size) {
1011 for (i = 0; i < num_pages; i++) 1011 int j;
1012 put_page(page[i]); 1012
1013 for (j = 0; j < num_pages; j++)
1014 put_page(page[i + j]);
1013 return -EFAULT; 1015 return -EFAULT;
1014 } 1016 }
1015 truesize = size * PAGE_SIZE; 1017 truesize = size * PAGE_SIZE;
diff --git a/drivers/net/usb/qmi_wwan.c b/drivers/net/usb/qmi_wwan.c
index cdddb396e4f8..606eba2872bd 100644
--- a/drivers/net/usb/qmi_wwan.c
+++ b/drivers/net/usb/qmi_wwan.c
@@ -592,7 +592,13 @@ static const struct usb_device_id products[] = {
592 {QMI_GOBI1K_DEVICE(0x03f0, 0x1f1d)}, /* HP un2400 Gobi Modem Device */ 592 {QMI_GOBI1K_DEVICE(0x03f0, 0x1f1d)}, /* HP un2400 Gobi Modem Device */
593 {QMI_GOBI1K_DEVICE(0x04da, 0x250d)}, /* Panasonic Gobi Modem device */ 593 {QMI_GOBI1K_DEVICE(0x04da, 0x250d)}, /* Panasonic Gobi Modem device */
594 {QMI_GOBI1K_DEVICE(0x413c, 0x8172)}, /* Dell Gobi Modem device */ 594 {QMI_GOBI1K_DEVICE(0x413c, 0x8172)}, /* Dell Gobi Modem device */
595 {QMI_GOBI1K_DEVICE(0x1410, 0xa001)}, /* Novatel Gobi Modem device */ 595 {QMI_GOBI1K_DEVICE(0x1410, 0xa001)}, /* Novatel/Verizon USB-1000 */
596 {QMI_GOBI1K_DEVICE(0x1410, 0xa002)}, /* Novatel Gobi Modem device */
597 {QMI_GOBI1K_DEVICE(0x1410, 0xa003)}, /* Novatel Gobi Modem device */
598 {QMI_GOBI1K_DEVICE(0x1410, 0xa004)}, /* Novatel Gobi Modem device */
599 {QMI_GOBI1K_DEVICE(0x1410, 0xa005)}, /* Novatel Gobi Modem device */
600 {QMI_GOBI1K_DEVICE(0x1410, 0xa006)}, /* Novatel Gobi Modem device */
601 {QMI_GOBI1K_DEVICE(0x1410, 0xa007)}, /* Novatel Gobi Modem device */
596 {QMI_GOBI1K_DEVICE(0x0b05, 0x1776)}, /* Asus Gobi Modem device */ 602 {QMI_GOBI1K_DEVICE(0x0b05, 0x1776)}, /* Asus Gobi Modem device */
597 {QMI_GOBI1K_DEVICE(0x19d2, 0xfff3)}, /* ONDA Gobi Modem device */ 603 {QMI_GOBI1K_DEVICE(0x19d2, 0xfff3)}, /* ONDA Gobi Modem device */
598 {QMI_GOBI1K_DEVICE(0x05c6, 0x9001)}, /* Generic Gobi Modem device */ 604 {QMI_GOBI1K_DEVICE(0x05c6, 0x9001)}, /* Generic Gobi Modem device */
diff --git a/drivers/net/wan/dlci.c b/drivers/net/wan/dlci.c
index 70ac59929f80..0d1c7592efa0 100644
--- a/drivers/net/wan/dlci.c
+++ b/drivers/net/wan/dlci.c
@@ -384,21 +384,37 @@ static int dlci_del(struct dlci_add *dlci)
384 struct frad_local *flp; 384 struct frad_local *flp;
385 struct net_device *master, *slave; 385 struct net_device *master, *slave;
386 int err; 386 int err;
387 bool found = false;
388
389 rtnl_lock();
387 390
388 /* validate slave device */ 391 /* validate slave device */
389 master = __dev_get_by_name(&init_net, dlci->devname); 392 master = __dev_get_by_name(&init_net, dlci->devname);
390 if (!master) 393 if (!master) {
391 return -ENODEV; 394 err = -ENODEV;
395 goto out;
396 }
397
398 list_for_each_entry(dlp, &dlci_devs, list) {
399 if (dlp->master == master) {
400 found = true;
401 break;
402 }
403 }
404 if (!found) {
405 err = -ENODEV;
406 goto out;
407 }
392 408
393 if (netif_running(master)) { 409 if (netif_running(master)) {
394 return -EBUSY; 410 err = -EBUSY;
411 goto out;
395 } 412 }
396 413
397 dlp = netdev_priv(master); 414 dlp = netdev_priv(master);
398 slave = dlp->slave; 415 slave = dlp->slave;
399 flp = netdev_priv(slave); 416 flp = netdev_priv(slave);
400 417
401 rtnl_lock();
402 err = (*flp->deassoc)(slave, master); 418 err = (*flp->deassoc)(slave, master);
403 if (!err) { 419 if (!err) {
404 list_del(&dlp->list); 420 list_del(&dlp->list);
@@ -407,8 +423,8 @@ static int dlci_del(struct dlci_add *dlci)
407 423
408 dev_put(slave); 424 dev_put(slave);
409 } 425 }
426out:
410 rtnl_unlock(); 427 rtnl_unlock();
411
412 return err; 428 return err;
413} 429}
414 430