Commit 6f08b72c authored by Kirill Smelkov's avatar Kirill Smelkov Committed by Linus Torvalds

[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: default avatarKirill Smelkov <kirr@mns.spb.ru>
Cc: Alan Cox <alan@lxorguk.ukuu.org.uk>
Signed-off-by: default avatarAndrew Morton <akpm@osdl.org>
Signed-off-by: default avatarLinus Torvalds <torvalds@osdl.org>
parent 64698b69
...@@ -917,6 +917,9 @@ static int mxser_open(struct tty_struct *tty, struct file *filp) ...@@ -917,6 +917,9 @@ static int mxser_open(struct tty_struct *tty, struct file *filp)
struct mxser_struct *info; struct mxser_struct *info;
int retval, line; int retval, line;
/* initialize driver_data in case something fails */
tty->driver_data = NULL;
line = tty->index; line = tty->index;
if (line == MXSER_PORTS) if (line == MXSER_PORTS)
return 0; return 0;
...@@ -979,7 +982,7 @@ static void mxser_close(struct tty_struct *tty, struct file *filp) ...@@ -979,7 +982,7 @@ static void mxser_close(struct tty_struct *tty, struct file *filp)
if (tty->index == MXSER_PORTS) if (tty->index == MXSER_PORTS)
return; return;
if (!info) if (!info)
BUG(); return;
spin_lock_irqsave(&info->slock, flags); spin_lock_irqsave(&info->slock, flags);
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment