]> git.baikalelectronics.ru Git - kernel.git/commitdiff
ibmvnic: register netdev after init of adapter
authorSukadev Bhattiprolu <sukadev@linux.ibm.com>
Fri, 25 Feb 2022 06:23:55 +0000 (22:23 -0800)
committerDavid S. Miller <davem@davemloft.net>
Fri, 25 Feb 2022 10:57:47 +0000 (10:57 +0000)
Finish initializing the adapter before registering netdev so state
is consistent.

Fixes: c26eba03e407 ("ibmvnic: Update reset infrastructure to support tunable parameters")
Signed-off-by: Sukadev Bhattiprolu <sukadev@linux.ibm.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
drivers/net/ethernet/ibm/ibmvnic.c

index 5913d372bc276351ef5c99a3f6155efcd65da67c..a7b03ca109d80efb36a3506b0865fa6f269ee7f9 100644 (file)
@@ -5826,12 +5826,6 @@ static int ibmvnic_probe(struct vio_dev *dev, const struct vio_device_id *id)
                goto ibmvnic_dev_file_err;
 
        netif_carrier_off(netdev);
-       rc = register_netdev(netdev);
-       if (rc) {
-               dev_err(&dev->dev, "failed to register netdev rc=%d\n", rc);
-               goto ibmvnic_register_fail;
-       }
-       dev_info(&dev->dev, "ibmvnic registered\n");
 
        if (init_success) {
                adapter->state = VNIC_PROBED;
@@ -5844,6 +5838,14 @@ static int ibmvnic_probe(struct vio_dev *dev, const struct vio_device_id *id)
 
        adapter->wait_for_reset = false;
        adapter->last_reset_time = jiffies;
+
+       rc = register_netdev(netdev);
+       if (rc) {
+               dev_err(&dev->dev, "failed to register netdev rc=%d\n", rc);
+               goto ibmvnic_register_fail;
+       }
+       dev_info(&dev->dev, "ibmvnic registered\n");
+
        return 0;
 
 ibmvnic_register_fail: