diff options
author | Jiri Slaby <jslaby@suse.cz> | 2012-03-05 08:52:01 -0500 |
---|---|---|
committer | Greg Kroah-Hartman <gregkh@linuxfoundation.org> | 2012-03-08 14:42:21 -0500 |
commit | 410235fd4d20b8feaf8930a0575d23acc088aa87 (patch) | |
tree | ad21d071a29ef0ad400393328ca4ab0588d5b2b7 /drivers/tty/serial/68328serial.c | |
parent | 44a1bfd95d0a6c0096e79a883197596e1ce83cc3 (diff) |
TTY: remove unneeded tty->index checks
Checking if tty->index is in bounds is not needed. The tty has the
index set in the initial open. This is done in get_tty_driver. And it
can be only in interval <0,driver->num).
So remove the tests which check exactly this interval. Some are
left untouched as they check against the current backing device count.
(Leaving apart that the check is racy in most of the cases.)
Signed-off-by: Jiri Slaby <jslaby@suse.cz>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
Diffstat (limited to 'drivers/tty/serial/68328serial.c')
-rw-r--r-- | drivers/tty/serial/68328serial.c | 9 |
1 files changed, 2 insertions, 7 deletions
diff --git a/drivers/tty/serial/68328serial.c b/drivers/tty/serial/68328serial.c index a88ef9782a4f..7398390e7e65 100644 --- a/drivers/tty/serial/68328serial.c +++ b/drivers/tty/serial/68328serial.c | |||
@@ -1190,14 +1190,9 @@ static int block_til_ready(struct tty_struct *tty, struct file * filp, | |||
1190 | int rs_open(struct tty_struct *tty, struct file * filp) | 1190 | int rs_open(struct tty_struct *tty, struct file * filp) |
1191 | { | 1191 | { |
1192 | struct m68k_serial *info; | 1192 | struct m68k_serial *info; |
1193 | int retval, line; | 1193 | int retval; |
1194 | |||
1195 | line = tty->index; | ||
1196 | |||
1197 | if (line >= NR_PORTS || line < 0) /* we have exactly one */ | ||
1198 | return -ENODEV; | ||
1199 | 1194 | ||
1200 | info = &m68k_soft[line]; | 1195 | info = &m68k_soft[tty->index]; |
1201 | 1196 | ||
1202 | if (serial_paranoia_check(info, tty->name, "rs_open")) | 1197 | if (serial_paranoia_check(info, tty->name, "rs_open")) |
1203 | return -ENODEV; | 1198 | return -ENODEV; |