net/mlx4_en: Move register_netdev() to the end of initialization function
authorEugenia Emantayev <eugenia@mellanox.com>
Tue, 25 Jun 2013 09:09:31 +0000 (12:09 +0300)
committerDavid S. Miller <davem@davemloft.net>
Tue, 25 Jun 2013 23:29:39 +0000 (16:29 -0700)
To avoid a race between the open function and everything that happens after
register_netdev() move it to be the last operation called.

Signed-off-by: Eugenia Emantayev <eugenia@mellanox.com>
Signed-off-by: Amir Vadai <amirv@mellanox.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
drivers/net/ethernet/mellanox/mlx4/en_netdev.c

index c0b02d7bcc2fe98cb2cfca2968b9ef435d22eac3..1f0f8170d79da2916c155345a975382bfc516494 100644 (file)
@@ -2323,6 +2323,8 @@ int mlx4_en_init_netdev(struct mlx4_en_dev *mdev, int port,
        mdev->pndev[port] = dev;
 
        netif_carrier_off(dev);
+       mlx4_en_set_default_moderation(priv);
+
        err = register_netdev(dev);
        if (err) {
                en_err(priv, "Netdev registration failed for port %d\n", port);
@@ -2354,7 +2356,6 @@ int mlx4_en_init_netdev(struct mlx4_en_dev *mdev, int port,
                en_err(priv, "Failed Initializing port\n");
                goto out;
        }
-       mlx4_en_set_default_moderation(priv);
        queue_delayed_work(mdev->workqueue, &priv->stats_task, STATS_DELAY);
 
        if (mdev->dev->caps.flags2 & MLX4_DEV_CAP_FLAG2_TS)