Skip to contentSkip to conversation

serial: remove unneeded code from serial_core.c

PATCH New Jayachandran C. 1 participant 1 message Oct 19, 2005 TTY layer and serial drivers

lore
Share & tools
lore
#0 lore raw

PATCH 1/1 serial: remove unneeded code from serial_core.c

This patch fixes an issue reported by Coverity in serial/serial_core.c

Error reported: Variable "&((info)->tty)->flags" tracked as NULL was passed to a function that dereferences it.

Patch description:
The later statements in the function assumes 'info->tty != NULL', so this check is not necessary. Probably a 'BUG_ON(info->tty == NULL)' can be added.

Signed-off-by Jayachandran C. <c.jayachandran at gmail.com>

---

 serial_core.c |    3 +--
 1 files changed, 1 insertion(+), 2 deletions(-)
drivers/serial/serial_core.c +1 -2
@@ -147,8 +147,7 @@
 	 * once we have successfully opened the port.  Also set
 	 * up the tty->alt_speed kludge
 	 */
-	if (info->tty)
-		set_bit(TTY_IO_ERROR, &info->tty->flags);
+	set_bit(TTY_IO_ERROR, &info->tty->flags);
 
 	if (port->type == PORT_UNKNOWN)
 		return 0;