[PATCH 5.10 065/105] ibmvnic: register netdev after init of adapter
From: Greg Kroah-Hartman
Date: Mon Mar 07 2022 - 04:50:27 EST
From: Sukadev Bhattiprolu <sukadev@xxxxxxxxxxxxx>
commit 570425f8c7c18b14fa8a2a58a0adb431968ad118 upstream.
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@xxxxxxxxxxxxx>
Signed-off-by: David S. Miller <davem@xxxxxxxxxxxxx>
Signed-off-by: Greg Kroah-Hartman <gregkh@xxxxxxxxxxxxxxxxxxx>
---
drivers/net/ethernet/ibm/ibmvnic.c | 10 ++++++----
1 file changed, 6 insertions(+), 4 deletions(-)
--- a/drivers/net/ethernet/ibm/ibmvnic.c
+++ b/drivers/net/ethernet/ibm/ibmvnic.c
@@ -5383,6 +5383,12 @@ static int ibmvnic_probe(struct vio_dev
goto ibmvnic_dev_file_err;
netif_carrier_off(netdev);
+
+ adapter->state = VNIC_PROBED;
+
+ 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);
@@ -5390,10 +5396,6 @@ static int ibmvnic_probe(struct vio_dev
}
dev_info(&dev->dev, "ibmvnic registered\n");
- adapter->state = VNIC_PROBED;
-
- adapter->wait_for_reset = false;
- adapter->last_reset_time = jiffies;
return 0;
ibmvnic_register_fail: