net/mlx5e: Fix mlx5e_tx_reporter_create return value
authorAya Levin <ayal@mellanox.com>
Wed, 3 Jul 2019 06:16:52 +0000 (09:16 +0300)
committerSaeed Mahameed <saeedm@mellanox.com>
Thu, 1 Aug 2019 19:33:32 +0000 (12:33 -0700)
Return error when failing to create a reporter in devlink. Since
NET_DEVLINK mandatory to MLX5_CORE in Kconfig, returned pointer
can't be NULL and can only hold an error in bad path.

Signed-off-by: Aya Levin <ayal@mellanox.com>
Reviewed-by: Tariq Toukan <tariqt@mellanox.com>
Acked-by: Jiri Pirko <jiri@mellanox.com>
Signed-off-by: Saeed Mahameed <saeedm@mellanox.com>
drivers/net/ethernet/mellanox/mlx5/core/en/reporter_tx.c

index f3d98748b2117575ad64c83b2bb962ec7a718786..383ecfd85d8a6232886705c3f9aab5d386b49f3c 100644 (file)
@@ -296,11 +296,13 @@ int mlx5e_tx_reporter_create(struct mlx5e_priv *priv)
                devlink_health_reporter_create(devlink, &mlx5_tx_reporter_ops,
                                               MLX5_REPORTER_TX_GRACEFUL_PERIOD,
                                               true, priv);
-       if (IS_ERR(priv->tx_reporter))
+       if (IS_ERR(priv->tx_reporter)) {
                netdev_warn(priv->netdev,
                            "Failed to create tx reporter, err = %ld\n",
                            PTR_ERR(priv->tx_reporter));
-       return IS_ERR_OR_NULL(priv->tx_reporter);
+               return PTR_ERR(priv->tx_reporter);
+       }
+       return 0;
 }
 
 void mlx5e_tx_reporter_destroy(struct mlx5e_priv *priv)