netdev.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH net] net: hyperv: initialize link status correctly
@ 2014-01-27  7:30 Jason Wang
  2014-01-27  8:35 ` David Miller
  2014-01-27 16:05 ` Haiyang Zhang
  0 siblings, 2 replies; 8+ messages in thread
From: Jason Wang @ 2014-01-27  7:30 UTC (permalink / raw)
  To: kys, haiyangz, devel, netdev, linux-kernel; +Cc: Jason Wang

Call netif_carrier_on() after register_device(). Otherwise it won't work since
the device was still in NETREG_UNINITIALIZED state.

Fixes a68f9614614749727286f675d15f1e09d13cb54a
(hyperv: Fix race between probe and open calls)

Cc: Haiyang Zhang <haiyangz@microsoft.com>
Cc: K. Y. Srinivasan <kys@microsoft.com>
Reported-by: Di Nie <dnie@redhat.com>
Tested-by: Di Nie <dnie@redhat.com>
Signed-off-by: Jason Wang <jasowang@redhat.com>
---
 drivers/net/hyperv/netvsc_drv.c | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/drivers/net/hyperv/netvsc_drv.c b/drivers/net/hyperv/netvsc_drv.c
index 71baeb3..dc11601 100644
--- a/drivers/net/hyperv/netvsc_drv.c
+++ b/drivers/net/hyperv/netvsc_drv.c
@@ -444,13 +444,13 @@ static int netvsc_probe(struct hv_device *dev,
 	}
 	memcpy(net->dev_addr, device_info.mac_adr, ETH_ALEN);
 
-	netif_carrier_on(net);
-
 	ret = register_netdev(net);
 	if (ret != 0) {
 		pr_err("Unable to register netdev.\n");
 		rndis_filter_device_remove(dev);
 		free_netdev(net);
+	} else {
+		netif_carrier_on(net);
 	}
 
 	return ret;
-- 
1.8.3.2

^ permalink raw reply related	[flat|nested] 8+ messages in thread

end of thread, other threads:[~2014-01-27 16:05 UTC | newest]

Thread overview: 8+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2014-01-27  7:30 [PATCH net] net: hyperv: initialize link status correctly Jason Wang
2014-01-27  8:35 ` David Miller
2014-01-27  9:40   ` Jason Wang
2014-01-27 10:22     ` Ben Hutchings
2014-01-27 10:28       ` Jason Wang
2014-01-27 10:30         ` Ben Hutchings
2014-01-27 10:37           ` Jason Wang
2014-01-27 16:05 ` Haiyang Zhang

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).