summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorKirill Smelkov <kirr@mns.spb.ru>2005-11-07 00:59:23 -0800
committerLinus Torvalds <torvalds@g5.osdl.org>2005-11-07 07:53:36 -0800
commit6f08b72cdd4b99a190c4e1fcddd63b401e5b572d (patch)
treeb872d31a8f05f66fa3d00cf1271582dc0d354c7c
parent64698b694db96b8db6f379de7d2040f61c6fc7bf (diff)
downloadlinux-stable-6f08b72cdd4b99a190c4e1fcddd63b401e5b572d.tar.gz
linux-stable-6f08b72cdd4b99a190c4e1fcddd63b401e5b572d.tar.bz2
linux-stable-6f08b72cdd4b99a190c4e1fcddd63b401e5b572d.zip
[PATCH] serial moxa: fix wrong BUG
There is a wrong BUG in mxser_close. The BUG is triggered when tty->driver_data == NULL, But in fact this is not a bug, because tty->driver->close is called even when tty->driver->open fails. LDD3 tells us to do nothing in such cases. Signed-off-by: Kirill Smelkov <kirr@mns.spb.ru> Cc: Alan Cox <alan@lxorguk.ukuu.org.uk> Signed-off-by: Andrew Morton <akpm@osdl.org> Signed-off-by: Linus Torvalds <torvalds@osdl.org>
-rw-r--r--drivers/char/mxser.c5
1 files changed, 4 insertions, 1 deletions
diff --git a/drivers/char/mxser.c b/drivers/char/mxser.c
index d5c34af8752d..3b965a651da4 100644
--- a/drivers/char/mxser.c
+++ b/drivers/char/mxser.c
@@ -917,6 +917,9 @@ static int mxser_open(struct tty_struct *tty, struct file *filp)
struct mxser_struct *info;
int retval, line;
+ /* initialize driver_data in case something fails */
+ tty->driver_data = NULL;
+
line = tty->index;
if (line == MXSER_PORTS)
return 0;
@@ -979,7 +982,7 @@ static void mxser_close(struct tty_struct *tty, struct file *filp)
if (tty->index == MXSER_PORTS)
return;
if (!info)
- BUG();
+ return;
spin_lock_irqsave(&info->slock, flags);