aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/char/generic_serial.c
diff options
context:
space:
mode:
authorAlan Cox <alan@redhat.com>2008-10-13 05:44:57 -0400
committerLinus Torvalds <torvalds@linux-foundation.org>2008-10-13 12:51:44 -0400
commit51383f69ec56fe3f425d5255fb43e18c445e061c (patch)
treef9d9e280892702c3a47ffa807c0937ea9c80e315 /drivers/char/generic_serial.c
parentea1afd256258f04a290aaa7fd5c2d4deb2e79e26 (diff)
tty: Remove lots of NULL checks
Many tty drivers contain 'can't happen' checks against NULL pointers passed in by the tty layer. These have never been possible to occur. Even more importantly if they ever do occur we want to know as it would be a serious bug. Signed-off-by: Alan Cox <alan@redhat.com> Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
Diffstat (limited to 'drivers/char/generic_serial.c')
-rw-r--r--drivers/char/generic_serial.c21
1 files changed, 0 insertions, 21 deletions
diff --git a/drivers/char/generic_serial.c b/drivers/char/generic_serial.c
index 19d3afb0e50c..c6090f84a2e4 100644
--- a/drivers/char/generic_serial.c
+++ b/drivers/char/generic_serial.c
@@ -54,8 +54,6 @@ int gs_put_char(struct tty_struct * tty, unsigned char ch)
54 54
55 func_enter (); 55 func_enter ();
56 56
57 if (!tty) return 0;
58
59 port = tty->driver_data; 57 port = tty->driver_data;
60 58
61 if (!port) return 0; 59 if (!port) return 0;
@@ -97,8 +95,6 @@ int gs_write(struct tty_struct * tty,
97 95
98 func_enter (); 96 func_enter ();
99 97
100 if (!tty) return 0;
101
102 port = tty->driver_data; 98 port = tty->driver_data;
103 99
104 if (!port) return 0; 100 if (!port) return 0;
@@ -185,7 +181,6 @@ static int gs_real_chars_in_buffer(struct tty_struct *tty)
185 struct gs_port *port; 181 struct gs_port *port;
186 func_enter (); 182 func_enter ();
187 183
188 if (!tty) return 0;
189 port = tty->driver_data; 184 port = tty->driver_data;
190 185
191 if (!port->rd) return 0; 186 if (!port->rd) return 0;
@@ -274,8 +269,6 @@ void gs_flush_buffer(struct tty_struct *tty)
274 269
275 func_enter (); 270 func_enter ();
276 271
277 if (!tty) return;
278
279 port = tty->driver_data; 272 port = tty->driver_data;
280 273
281 if (!port) return; 274 if (!port) return;
@@ -296,8 +289,6 @@ void gs_flush_chars(struct tty_struct * tty)
296 289
297 func_enter (); 290 func_enter ();
298 291
299 if (!tty) return;
300
301 port = tty->driver_data; 292 port = tty->driver_data;
302 293
303 if (!port) return; 294 if (!port) return;
@@ -321,8 +312,6 @@ void gs_stop(struct tty_struct * tty)
321 312
322 func_enter (); 313 func_enter ();
323 314
324 if (!tty) return;
325
326 port = tty->driver_data; 315 port = tty->driver_data;
327 316
328 if (!port) return; 317 if (!port) return;
@@ -341,8 +330,6 @@ void gs_start(struct tty_struct * tty)
341{ 330{
342 struct gs_port *port; 331 struct gs_port *port;
343 332
344 if (!tty) return;
345
346 port = tty->driver_data; 333 port = tty->driver_data;
347 334
348 if (!port) return; 335 if (!port) return;
@@ -393,8 +380,6 @@ void gs_hangup(struct tty_struct *tty)
393 380
394 func_enter (); 381 func_enter ();
395 382
396 if (!tty) return;
397
398 port = tty->driver_data; 383 port = tty->driver_data;
399 tty = port->port.tty; 384 tty = port->port.tty;
400 if (!tty) 385 if (!tty)
@@ -426,8 +411,6 @@ int gs_block_til_ready(void *port_, struct file * filp)
426 411
427 tty = port->port.tty; 412 tty = port->port.tty;
428 413
429 if (!tty) return 0;
430
431 gs_dprintk (GS_DEBUG_BTR, "Entering gs_block_till_ready.\n"); 414 gs_dprintk (GS_DEBUG_BTR, "Entering gs_block_till_ready.\n");
432 /* 415 /*
433 * If the device is in the middle of being closed, then block 416 * If the device is in the middle of being closed, then block
@@ -523,8 +506,6 @@ void gs_close(struct tty_struct * tty, struct file * filp)
523 506
524 func_enter (); 507 func_enter ();
525 508
526 if (!tty) return;
527
528 port = (struct gs_port *) tty->driver_data; 509 port = (struct gs_port *) tty->driver_data;
529 510
530 if (!port) return; 511 if (!port) return;
@@ -621,8 +602,6 @@ void gs_set_termios (struct tty_struct * tty,
621 602
622 func_enter(); 603 func_enter();
623 604
624 if (!tty) return;
625
626 port = tty->driver_data; 605 port = tty->driver_data;
627 606
628 if (!port) return; 607 if (!port) return;