Skip to contentSkip to conversation

serial moxa: fix wrong BUG

PATCH New Kirill Smelkov 1 participant 1 message Oct 31, 2005

Subsystems (2)
lore
Share & tools
lore
#0 lore raw

PATCH 1/1 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.

drivers/char/mxser.c +4 -1
Index: linux-2.6.14/drivers/char/mxser.c
===================================================================
@@ -917,6 +917,9 @@
 	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 @@
 	if (tty->index == MXSER_PORTS)
 		return;
 	if (!info)
-		BUG();
+		return;
 
 	spin_lock_irqsave(&info->slock, flags);