mail archive of the barebox mailing list
 help / color / mirror / Atom feed
* [PATCH] netconsole: bail out when no connection is opened
@ 2014-03-31  7:21 Sascha Hauer
  0 siblings, 0 replies; only message in thread
From: Sascha Hauer @ 2014-03-31  7:21 UTC (permalink / raw)
  To: barebox

When no connection is opened we should not call into
the networking stack. Otherwise it can happen that we
delay further execution until the network stack detected
a link (or timed out bringing the link up).

Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
---
 net/netconsole.c | 6 ++++++
 1 file changed, 6 insertions(+)

diff --git a/net/netconsole.c b/net/netconsole.c
index 2ab19de..86a68e1 100644
--- a/net/netconsole.c
+++ b/net/netconsole.c
@@ -81,6 +81,9 @@ static int nc_getc(struct console_device *cdev)
 					struct nc_priv, cdev);
 	unsigned char c;
 
+	if (!priv->con)
+		return 0;
+
 	while (!kfifo_len(priv->fifo))
 		net_poll();
 
@@ -94,6 +97,9 @@ static int nc_tstc(struct console_device *cdev)
 	struct nc_priv *priv = container_of(cdev,
 					struct nc_priv, cdev);
 
+	if (!priv->con)
+		return 0;
+
 	if (priv->busy)
 		return kfifo_len(priv->fifo) ? 1 : 0;
 
-- 
1.9.1


_______________________________________________
barebox mailing list
barebox@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/barebox

^ permalink raw reply	[flat|nested] only message in thread

only message in thread, other threads:[~2014-03-31  7:21 UTC | newest]

Thread overview: (only message) (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2014-03-31  7:21 [PATCH] netconsole: bail out when no connection is opened Sascha Hauer

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox