TTY: switch tty_insert_flip_char
Hello Jiri Slaby,
The patch 92a19f9cec9a: "TTY: switch tty_insert_flip_char" from Jan 3, 2013, leads to the following static checker warning:
drivers/tty/serial/sc26xx.c:189 receive_chars() error: potential NULL dereference 'tport'.
drivers/tty/serial/sc26xx.c
139 static bool receive_chars(struct uart_port *port) 140 {
141 struct tty_port *tport = NULL; 142 int limit = 10000; 143 unsigned char ch; 144 char flag; 145 u8 status;
146
147 /* FIXME what is this trying to achieve? */
148 if (port->state != NULL) /* Unopened serial console */
149 tport = &port->state->port;
"tport" can be NULL if port->state is NULL. It's not clear if this is actually possible.
150
[ snip ]
182 183 if (uart_handle_sysrq_char(port, ch)) 184 continue; 185 186 if (status & port->ignore_status_mask) 187 continue; 188 189 tty_insert_flip_char(tport, ch, flag); 190 } 191 return !!tport;
regards,
dan carpenter