Skip to content

Commit bc1f447

Browse files
shemmingerdavem330
authored andcommitted
net: make ndo_get_stats64 a void function
The network device operation for reading statistics is only called in one place, and it ignores the return value. Having a structure return value is potentially confusing because some future driver could incorrectly assume that the return value was used. Fix all drivers with ndo_get_stats64 to have a void function. Signed-off-by: Stephen Hemminger <[email protected]> Signed-off-by: David S. Miller <[email protected]>
1 parent 63c64de commit bc1f447

File tree

82 files changed

+166
-309
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

82 files changed

+166
-309
lines changed

drivers/net/bonding/bond_main.c

Lines changed: 4 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -211,8 +211,8 @@ static int lacp_fast;
211211

212212
static int bond_init(struct net_device *bond_dev);
213213
static void bond_uninit(struct net_device *bond_dev);
214-
static struct rtnl_link_stats64 *bond_get_stats(struct net_device *bond_dev,
215-
struct rtnl_link_stats64 *stats);
214+
static void bond_get_stats(struct net_device *bond_dev,
215+
struct rtnl_link_stats64 *stats);
216216
static void bond_slave_arr_handler(struct work_struct *work);
217217
static bool bond_time_in_interval(struct bonding *bond, unsigned long last_act,
218218
int mod);
@@ -3337,8 +3337,8 @@ static void bond_fold_stats(struct rtnl_link_stats64 *_res,
33373337
}
33383338
}
33393339

3340-
static struct rtnl_link_stats64 *bond_get_stats(struct net_device *bond_dev,
3341-
struct rtnl_link_stats64 *stats)
3340+
static void bond_get_stats(struct net_device *bond_dev,
3341+
struct rtnl_link_stats64 *stats)
33423342
{
33433343
struct bonding *bond = netdev_priv(bond_dev);
33443344
struct rtnl_link_stats64 temp;
@@ -3362,8 +3362,6 @@ static struct rtnl_link_stats64 *bond_get_stats(struct net_device *bond_dev,
33623362

33633363
memcpy(&bond->bond_stats, stats, sizeof(*stats));
33643364
spin_unlock(&bond->stats_lock);
3365-
3366-
return stats;
33673365
}
33683366

33693367
static int bond_do_ioctl(struct net_device *bond_dev, struct ifreq *ifr, int cmd)

drivers/net/dummy.c

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -54,8 +54,8 @@ struct pcpu_dstats {
5454
struct u64_stats_sync syncp;
5555
};
5656

57-
static struct rtnl_link_stats64 *dummy_get_stats64(struct net_device *dev,
58-
struct rtnl_link_stats64 *stats)
57+
static void dummy_get_stats64(struct net_device *dev,
58+
struct rtnl_link_stats64 *stats)
5959
{
6060
int i;
6161

@@ -73,7 +73,6 @@ static struct rtnl_link_stats64 *dummy_get_stats64(struct net_device *dev,
7373
stats->tx_bytes += tbytes;
7474
stats->tx_packets += tpackets;
7575
}
76-
return stats;
7776
}
7877

7978
static netdev_tx_t dummy_xmit(struct sk_buff *skb, struct net_device *dev)

drivers/net/ethernet/alacritech/slicoss.c

Lines changed: 2 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1471,8 +1471,8 @@ static netdev_tx_t slic_xmit(struct sk_buff *skb, struct net_device *dev)
14711471
return NETDEV_TX_OK;
14721472
}
14731473

1474-
static struct rtnl_link_stats64 *slic_get_stats(struct net_device *dev,
1475-
struct rtnl_link_stats64 *lst)
1474+
static void slic_get_stats(struct net_device *dev,
1475+
struct rtnl_link_stats64 *lst)
14761476
{
14771477
struct slic_device *sdev = netdev_priv(dev);
14781478
struct slic_stats *stats = &sdev->stats;
@@ -1489,8 +1489,6 @@ static struct rtnl_link_stats64 *slic_get_stats(struct net_device *dev,
14891489
SLIC_GET_STATS_COUNTER(lst->rx_crc_errors, stats, rx_crc);
14901490
SLIC_GET_STATS_COUNTER(lst->rx_fifo_errors, stats, rx_oflow802);
14911491
SLIC_GET_STATS_COUNTER(lst->tx_carrier_errors, stats, tx_carrier);
1492-
1493-
return lst;
14941492
}
14951493

14961494
static int slic_get_sset_count(struct net_device *dev, int sset)

drivers/net/ethernet/amazon/ena/ena_netdev.c

Lines changed: 4 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -2165,19 +2165,19 @@ static void ena_config_debug_area(struct ena_adapter *adapter)
21652165
ena_com_delete_debug_area(adapter->ena_dev);
21662166
}
21672167

2168-
static struct rtnl_link_stats64 *ena_get_stats64(struct net_device *netdev,
2169-
struct rtnl_link_stats64 *stats)
2168+
static void ena_get_stats64(struct net_device *netdev,
2169+
struct rtnl_link_stats64 *stats)
21702170
{
21712171
struct ena_adapter *adapter = netdev_priv(netdev);
21722172
struct ena_admin_basic_stats ena_stats;
21732173
int rc;
21742174

21752175
if (!test_bit(ENA_FLAG_DEV_UP, &adapter->flags))
2176-
return NULL;
2176+
return;
21772177

21782178
rc = ena_com_get_dev_basic_stats(adapter->ena_dev, &ena_stats);
21792179
if (rc)
2180-
return NULL;
2180+
return;
21812181

21822182
stats->tx_bytes = ((u64)ena_stats.tx_bytes_high << 32) |
21832183
ena_stats.tx_bytes_low;
@@ -2204,8 +2204,6 @@ static struct rtnl_link_stats64 *ena_get_stats64(struct net_device *netdev,
22042204

22052205
stats->rx_errors = 0;
22062206
stats->tx_errors = 0;
2207-
2208-
return stats;
22092207
}
22102208

22112209
static const struct net_device_ops ena_netdev_ops = {

drivers/net/ethernet/amd/xgbe/xgbe-drv.c

Lines changed: 2 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1759,8 +1759,8 @@ static void xgbe_tx_timeout(struct net_device *netdev)
17591759
schedule_work(&pdata->restart_work);
17601760
}
17611761

1762-
static struct rtnl_link_stats64 *xgbe_get_stats64(struct net_device *netdev,
1763-
struct rtnl_link_stats64 *s)
1762+
static void xgbe_get_stats64(struct net_device *netdev,
1763+
struct rtnl_link_stats64 *s)
17641764
{
17651765
struct xgbe_prv_data *pdata = netdev_priv(netdev);
17661766
struct xgbe_mmc_stats *pstats = &pdata->mmc_stats;
@@ -1786,8 +1786,6 @@ static struct rtnl_link_stats64 *xgbe_get_stats64(struct net_device *netdev,
17861786
s->tx_dropped = netdev->stats.tx_dropped;
17871787

17881788
DBGPR("<--%s\n", __func__);
1789-
1790-
return s;
17911789
}
17921790

17931791
static int xgbe_vlan_rx_add_vid(struct net_device *netdev, __be16 proto,

drivers/net/ethernet/apm/xgene/xgene_enet_main.c

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1453,7 +1453,7 @@ static int xgene_enet_create_desc_rings(struct net_device *ndev)
14531453
return ret;
14541454
}
14551455

1456-
static struct rtnl_link_stats64 *xgene_enet_get_stats64(
1456+
static void xgene_enet_get_stats64(
14571457
struct net_device *ndev,
14581458
struct rtnl_link_stats64 *storage)
14591459
{
@@ -1484,8 +1484,6 @@ static struct rtnl_link_stats64 *xgene_enet_get_stats64(
14841484
}
14851485
}
14861486
memcpy(storage, stats, sizeof(struct rtnl_link_stats64));
1487-
1488-
return storage;
14891487
}
14901488

14911489
static int xgene_enet_set_mac_address(struct net_device *ndev, void *addr)

drivers/net/ethernet/atheros/alx/main.c

Lines changed: 2 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1643,8 +1643,8 @@ static void alx_poll_controller(struct net_device *netdev)
16431643
}
16441644
#endif
16451645

1646-
static struct rtnl_link_stats64 *alx_get_stats64(struct net_device *dev,
1647-
struct rtnl_link_stats64 *net_stats)
1646+
static void alx_get_stats64(struct net_device *dev,
1647+
struct rtnl_link_stats64 *net_stats)
16481648
{
16491649
struct alx_priv *alx = netdev_priv(dev);
16501650
struct alx_hw_stats *hw_stats = &alx->hw.stats;
@@ -1688,8 +1688,6 @@ static struct rtnl_link_stats64 *alx_get_stats64(struct net_device *dev,
16881688
net_stats->rx_packets = hw_stats->rx_ok + net_stats->rx_errors;
16891689

16901690
spin_unlock(&alx->stats_lock);
1691-
1692-
return net_stats;
16931691
}
16941692

16951693
static const struct net_device_ops alx_netdev_ops = {

drivers/net/ethernet/broadcom/b44.c

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1674,8 +1674,8 @@ static int b44_close(struct net_device *dev)
16741674
return 0;
16751675
}
16761676

1677-
static struct rtnl_link_stats64 *b44_get_stats64(struct net_device *dev,
1678-
struct rtnl_link_stats64 *nstat)
1677+
static void b44_get_stats64(struct net_device *dev,
1678+
struct rtnl_link_stats64 *nstat)
16791679
{
16801680
struct b44 *bp = netdev_priv(dev);
16811681
struct b44_hw_stats *hwstat = &bp->hw_stats;
@@ -1718,7 +1718,6 @@ static struct rtnl_link_stats64 *b44_get_stats64(struct net_device *dev,
17181718
#endif
17191719
} while (u64_stats_fetch_retry_irq(&hwstat->syncp, start));
17201720

1721-
return nstat;
17221721
}
17231722

17241723
static int __b44_load_mcast(struct b44 *bp, struct net_device *dev)

drivers/net/ethernet/broadcom/bnx2.c

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -6821,13 +6821,13 @@ bnx2_save_stats(struct bnx2 *bp)
68216821
(unsigned long) (bp->stats_blk->ctr + \
68226822
bp->temp_stats_blk->ctr)
68236823

6824-
static struct rtnl_link_stats64 *
6824+
static void
68256825
bnx2_get_stats64(struct net_device *dev, struct rtnl_link_stats64 *net_stats)
68266826
{
68276827
struct bnx2 *bp = netdev_priv(dev);
68286828

68296829
if (bp->stats_blk == NULL)
6830-
return net_stats;
6830+
return;
68316831

68326832
net_stats->rx_packets =
68336833
GET_64BIT_NET_STATS(stat_IfHCInUcastPkts) +
@@ -6891,7 +6891,6 @@ bnx2_get_stats64(struct net_device *dev, struct rtnl_link_stats64 *net_stats)
68916891
GET_32BIT_NET_STATS(stat_IfInMBUFDiscards) +
68926892
GET_32BIT_NET_STATS(stat_FwRxDrop);
68936893

6894-
return net_stats;
68956894
}
68966895

68976896
/* All ethtool functions called with rtnl_lock */

drivers/net/ethernet/broadcom/bnxt/bnxt.c

Lines changed: 2 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -5879,7 +5879,7 @@ static int bnxt_ioctl(struct net_device *dev, struct ifreq *ifr, int cmd)
58795879
return -EOPNOTSUPP;
58805880
}
58815881

5882-
static struct rtnl_link_stats64 *
5882+
static void
58835883
bnxt_get_stats64(struct net_device *dev, struct rtnl_link_stats64 *stats)
58845884
{
58855885
u32 i;
@@ -5888,7 +5888,7 @@ bnxt_get_stats64(struct net_device *dev, struct rtnl_link_stats64 *stats)
58885888
memset(stats, 0, sizeof(struct rtnl_link_stats64));
58895889

58905890
if (!bp->bnapi)
5891-
return stats;
5891+
return;
58925892

58935893
/* TODO check if we need to synchronize with bnxt_close path */
58945894
for (i = 0; i < bp->cp_nr_rings; i++) {
@@ -5935,8 +5935,6 @@ bnxt_get_stats64(struct net_device *dev, struct rtnl_link_stats64 *stats)
59355935
stats->tx_fifo_errors = le64_to_cpu(tx->tx_fifo_underruns);
59365936
stats->tx_errors = le64_to_cpu(tx->tx_err);
59375937
}
5938-
5939-
return stats;
59405938
}
59415939

59425940
static bool bnxt_mc_list_updated(struct bnxt *bp, u32 *rx_mask)

0 commit comments

Comments
 (0)