mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
From: Ilya Shchepetkov <shchepetkov@ispras.ru>
To: Robin Holt <holt@sgi.com>
Cc: Ilya Shchepetkov <shchepetkov@ispras.ru>,
	"David S. Miller" <davem@davemloft.net>,
	linux-kernel@vger.kernel.org, ldv-project@ispras.ru
Subject: [PATCH 1/5] sgi-xp: Call netif_carrier_off() after register_netdev()
Date: Tue, 14 Aug 2012 14:28:51 +0400	[thread overview]
Message-ID: <1344940135-17079-2-git-send-email-shchepetkov@ispras.ru> (raw)
In-Reply-To: <1344940135-17079-1-git-send-email-shchepetkov@ispras.ru>

For carrier detection to work properly when binding the driver with a
cable unplugged, netif_carrier_off() should be calle after
register_netdev(), not before.

Calling netif_carrier_off() before register_netdev() was causing the
network interface to miss a linkwatch pending event leading to an
inconsistent state if the link is not up when interface is initialized.

Found by Linux Driver Verification project (linuxtesting.org).

Signed-off-by: Ilya Shchepetkov <shchepetkov@ispras.ru>
---
 drivers/misc/sgi-xp/xpnet.c |    4 ++--
 1 files changed, 2 insertions(+), 2 deletions(-)

diff --git a/drivers/misc/sgi-xp/xpnet.c b/drivers/misc/sgi-xp/xpnet.c
index 3fac67a..9296c8d 100644
--- a/drivers/misc/sgi-xp/xpnet.c
+++ b/drivers/misc/sgi-xp/xpnet.c
@@ -550,8 +550,6 @@ xpnet_init(void)
 		return -ENOMEM;
 	}
 
-	netif_carrier_off(xpnet_device);
-
 	xpnet_device->netdev_ops = &xpnet_netdev_ops;
 	xpnet_device->mtu = XPNET_DEF_MTU;
 
@@ -584,6 +582,8 @@ xpnet_init(void)
 		kfree(xpnet_broadcast_partitions);
 	}
 
+	netif_carrier_off(xpnet_device);
+
 	return result;
 }
 
-- 
1.7.7


  reply	other threads:[~2012-08-14 10:30 UTC|newest]

Thread overview: 15+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2012-08-14 10:28 [PATCH 0/5] " Ilya Shchepetkov
2012-08-14 10:28 ` Ilya Shchepetkov [this message]
2012-08-14 14:22   ` [PATCH 1/5] sgi-xp: " Robin Holt
2012-08-14 10:28 ` [PATCH 2/5] de2104x: " Ilya Shchepetkov
2012-08-14 10:28 ` [PATCH 3/5] net/mlx4_en: " Ilya Shchepetkov
2012-08-14 12:36   ` Sathya.Perla
2012-08-14 14:56     ` Ben Hutchings
2012-08-14 10:28 ` [PATCH 4/5] sungem: " Ilya Shchepetkov
2012-08-14 10:28 ` [PATCH 5/5] net/hyperv: " Ilya Shchepetkov
2012-08-14 15:32   ` Haiyang Zhang
2012-08-14 21:00 ` [PATCH 0/5] " David Miller
2012-08-14 22:47   ` Ben Hutchings
2012-08-15 11:40     ` Bjørn Mork
2012-08-17  7:55       ` Ilya Shchepetkov
2012-08-17 16:20         ` Stephen Hemminger

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=1344940135-17079-2-git-send-email-shchepetkov@ispras.ru \
    --to=shchepetkov@ispras.ru \
    --cc=davem@davemloft.net \
    --cc=holt@sgi.com \
    --cc=ldv-project@ispras.ru \
    --cc=linux-kernel@vger.kernel.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox

all inboxes | Powered by JetHome®