diff options
author | Sascha Hauer <s.hauer@pengutronix.de> | 2014-03-13 22:09:47 +0100 |
---|---|---|
committer | Sascha Hauer <s.hauer@pengutronix.de> | 2014-03-31 09:19:35 +0200 |
commit | 33987e9600a9edb109dab88b60c151277edb8d18 (patch) | |
tree | afbfecbb80ed352ffc8058c9d4eb5187d803f7ed | |
parent | 88ffe722784491f0f6bbd3a8719b5de3db5a6853 (diff) | |
download | barebox-33987e9600a9edb109dab88b60c151277edb8d18.tar.gz barebox-33987e9600a9edb109dab88b60c151277edb8d18.tar.xz |
netconsole: bail out when no connection is opened
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>
-rw-r--r-- | net/netconsole.c | 6 |
1 files changed, 6 insertions, 0 deletions
diff --git a/net/netconsole.c b/net/netconsole.c index 2ab19de4d5..86a68e19d9 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; |