@@ -58,11 +58,11 @@ struct appldata_net_sum_data {
*/
static void appldata_get_net_sum_data(void *data)
{
- int i;
struct appldata_net_sum_data *net_data;
struct net_device *dev;
unsigned long rx_packets, tx_packets, rx_bytes, tx_bytes, rx_errors,
tx_errors, rx_dropped, tx_dropped, collisions;
+ int ret, i;
net_data = data;
net_data->sync_count_1++;
@@ -83,7 +83,13 @@ static void appldata_get_net_sum_data(void *data)
for_each_netdev(&init_net, dev) {
struct rtnl_link_stats64 stats;
- dev_get_stats(dev, &stats);
+ ret = dev_get_stats(dev, &stats);
+ if (ret) {
+ netif_lists_unlock(&init_net);
+ netdev_err(dev, "dev_get_stats returned %d\n", ret);
+ return;
+ }
+
rx_packets += stats.rx_packets;
tx_packets += stats.tx_packets;
rx_bytes += stats.rx_bytes;
@@ -351,6 +351,7 @@ static void netdev_trig_work(struct work_struct *work)
unsigned int new_activity;
unsigned long interval;
int invert;
+ int err;
/* If we dont have a device, insure we are off */
if (!trigger_data->net_dev) {
@@ -363,7 +364,13 @@ static void netdev_trig_work(struct work_struct *work)
!test_bit(NETDEV_LED_RX, &trigger_data->mode))
return;
- dev_get_stats(trigger_data->net_dev, &dev_stats);
+ err = dev_get_stats(trigger_data->net_dev, &dev_stats);
+ if (err) {
+ netdev_err(trigger_data->net_dev,
+ "dev_get_stats returned %d\n", err);
+ return;
+ }
+
new_activity =
(test_bit(NETDEV_LED_TX, &trigger_data->mode) ?
dev_stats.tx_packets : 0) +
@@ -266,9 +266,14 @@ static void xgene_get_ethtool_stats(struct net_device *ndev,
{
struct xgene_enet_pdata *pdata = netdev_priv(ndev);
struct rtnl_link_stats64 stats;
- int i;
+ int err, i;
+
+ err = dev_get_stats(ndev, &stats);
+ if (err) {
+ netdev_err(ndev, "dev_get_stats returned %d\n", err);
+ return;
+ }
- dev_get_stats(ndev, &stats);
for (i = 0; i < XGENE_STATS_LEN; i++)
data[i] = *(u64 *)((char *)&stats + gstrings_stats[i].offset);
@@ -840,6 +840,7 @@ static void hns_get_ethtool_stats(struct net_device *netdev,
struct hns_nic_priv *priv = netdev_priv(netdev);
struct hnae_handle *h = priv->ae_handle;
struct rtnl_link_stats64 net_stats;
+ int err;
if (!h->dev->ops->get_stats || !h->dev->ops->update_stats) {
netdev_err(netdev, "get_stats or update_stats is null!\n");
@@ -848,7 +849,11 @@ static void hns_get_ethtool_stats(struct net_device *netdev,
h->dev->ops->update_stats(h, &netdev->stats);
- dev_get_stats(netdev, &net_stats);
+ err = dev_get_stats(netdev, &net_stats);
+ if (err) {
+ netdev_err(netdev, "dev_get_stats returned %d\n", err);
+ return;
+ }
/* get netdev statistics */
p[0] = net_stats.rx_packets;
@@ -2060,15 +2060,20 @@ static void e1000_get_ethtool_stats(struct net_device *netdev,
{
struct e1000_adapter *adapter = netdev_priv(netdev);
struct rtnl_link_stats64 net_stats;
- int i;
char *p = NULL;
+ int err, i;
pm_runtime_get_sync(netdev->dev.parent);
- dev_get_stats(netdev, &net_stats);
+ err = dev_get_stats(netdev, &net_stats);
pm_runtime_put_sync(netdev->dev.parent);
+ if (err) {
+ netdev_err(netdev, "dev_get_stats returned %d\n", err);
+ return;
+ }
+
for (i = 0; i < E1000_GLOBAL_STATS_LEN; i++) {
switch (e1000_gstrings_stats[i].type) {
case NETDEV_STATS:
@@ -1298,11 +1298,16 @@ static void ixgbe_get_ethtool_stats(struct net_device *netdev,
struct rtnl_link_stats64 net_stats;
unsigned int start;
struct ixgbe_ring *ring;
- int i, j;
char *p = NULL;
+ int err, i, j;
ixgbe_update_stats(adapter);
- dev_get_stats(netdev, &net_stats);
+ err = dev_get_stats(netdev, &net_stats);
+ if (err) {
+ netdev_err(netdev, "dev_get_stats returned %d\n", err);
+ return;
+ }
+
for (i = 0; i < IXGBE_GLOBAL_STATS_LEN; i++) {
switch (ixgbe_gstrings_stats[i].type) {
case NETDEV_STATS:
@@ -423,11 +423,16 @@ static void ixgbevf_get_ethtool_stats(struct net_device *netdev,
struct rtnl_link_stats64 net_stats;
unsigned int start;
struct ixgbevf_ring *ring;
- int i, j;
+ int err, i, j;
char *p;
ixgbevf_update_stats(adapter);
- dev_get_stats(netdev, &net_stats);
+ err = dev_get_stats(netdev, &net_stats);
+ if (err) {
+ netdev_err(netdev, "dev_get_stats returned %d\n", err);
+ return;
+ }
+
for (i = 0; i < IXGBEVF_GLOBAL_STATS_LEN; i++) {
switch (ixgbevf_gstrings_stats[i].type) {
case NETDEV_STATS: