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>
这个提交包含在:
Jiri Slaby
2012-03-05 14:52:01 +01:00
提交者 Greg Kroah-Hartman
父节点 44a1bfd95d
当前提交 410235fd4d
修改 21 个文件,包含 38 行新增95 行删除

查看文件

@@ -1190,14 +1190,9 @@ static int block_til_ready(struct tty_struct *tty, struct file * filp,
int rs_open(struct tty_struct *tty, struct file * filp)
{
struct m68k_serial *info;
int retval, line;
int retval;
line = tty->index;
if (line >= NR_PORTS || line < 0) /* we have exactly one */
return -ENODEV;
info = &m68k_soft[line];
info = &m68k_soft[tty->index];
if (serial_paranoia_check(info, tty->name, "rs_open"))
return -ENODEV;