diff options
author | jdike <jdike> | 2003-11-10 22:55:43 +0000 |
---|---|---|
committer | jdike <jdike> | 2003-11-10 22:55:43 +0000 |
commit | 67f4a427cf96ca6df6cdf25f245c57bd7e415892 (patch) | |
tree | 3e34359177ce72ced359749cd11764332432a21a | |
parent | 89ac6484de1e695819ba7b40992d514e363e27a8 (diff) | |
download | uml-history-67f4a427cf96ca6df6cdf25f245c57bd7e415892.tar.gz |
Fixed a crash when a device is asked for its configuration, and it has no
channels assocated with it.
Cleaned up some code.
-rw-r--r-- | arch/um/drivers/chan_kern.c | 12 |
1 files changed, 10 insertions, 2 deletions
diff --git a/arch/um/drivers/chan_kern.c b/arch/um/drivers/chan_kern.c index 0f69c64..33d7ac0 100644 --- a/arch/um/drivers/chan_kern.c +++ b/arch/um/drivers/chan_kern.c @@ -266,6 +266,11 @@ static int one_chan_config_string(struct chan *chan, char *str, int size, { int n = 0; + if(chan == NULL){ + CONFIG_CHUNK(str, size, n, "none", 1); + return(n); + } + CONFIG_CHUNK(str, size, n, chan->ops->type, 0); if(chan->dev == NULL){ @@ -477,12 +482,15 @@ void chan_interrupt(struct list_head *chans, struct tq_struct *task, goto out; } err = chan->ops->read(chan->fd, &c, chan->data); - if(err > 0) tty_receive_char(tty, c); + if(err > 0) + tty_receive_char(tty, c); } while(err > 0); + if(err == 0) reactivate_fd(chan->fd, irq); if(err == -EIO){ if(chan->primary){ - if(tty != NULL) tty_hangup(tty); + if(tty != NULL) + tty_hangup(tty); line_disable(dev, irq); close_chan(chans); free_chan(chans); |