net/mlx5: fix probe failure report
[dpdk.git] / drivers / net / mlx5 / mlx5_stats.c
index 1953293..d443e13 100644 (file)
 #include <linux/sockios.h>
 #include <linux/ethtool.h>
 
-/* DPDK headers don't like -pedantic. */
-#ifdef PEDANTIC
-#pragma GCC diagnostic ignored "-Wpedantic"
-#endif
 #include <rte_ethdev.h>
 #include <rte_common.h>
 #include <rte_malloc.h>
-#ifdef PEDANTIC
-#pragma GCC diagnostic error "-Wpedantic"
-#endif
 
 #include "mlx5.h"
 #include "mlx5_rxtx.h"
@@ -253,7 +246,7 @@ priv_xstats_init(struct priv *priv)
                }
        }
        for (j = 0; j != xstats_n; ++j) {
-               if (priv_is_ib_cntr(mlx5_counters_init[i].ctr_name))
+               if (priv_is_ib_cntr(mlx5_counters_init[j].ctr_name))
                        continue;
                if (xstats_ctrl->dev_table_idx[j] >= dev_stats_n) {
                        WARN("counter \"%s\" is not recognized",
@@ -442,8 +435,10 @@ mlx5_xstats_get(struct rte_eth_dev *dev,
 
                priv_lock(priv);
                stats_n = priv_ethtool_get_stats_n(priv);
-               if (stats_n < 0)
+               if (stats_n < 0) {
+                       priv_unlock(priv);
                        return -1;
+               }
                if (xstats_ctrl->stats_n != stats_n)
                        priv_xstats_init(priv);
                ret = priv_xstats_get(priv, stats);
@@ -468,10 +463,11 @@ mlx5_xstats_reset(struct rte_eth_dev *dev)
        priv_lock(priv);
        stats_n = priv_ethtool_get_stats_n(priv);
        if (stats_n < 0)
-               return;
+               goto unlock;
        if (xstats_ctrl->stats_n != stats_n)
                priv_xstats_init(priv);
        priv_xstats_reset(priv);
+unlock:
        priv_unlock(priv);
 }