summaryrefslogtreecommitdiff
path: root/drivers/tty/cyclades.c
diff options
context:
space:
mode:
authorJiri Slaby <jslaby@suse.cz>2012-03-05 13:52:01 (GMT)
committerGreg Kroah-Hartman <gregkh@linuxfoundation.org>2012-03-08 19:42:21 (GMT)
commit410235fd4d20b8feaf8930a0575d23acc088aa87 (patch)
treead21d071a29ef0ad400393328ca4ab0588d5b2b7 /drivers/tty/cyclades.c
parent44a1bfd95d0a6c0096e79a883197596e1ce83cc3 (diff)
downloadlinux-fsl-qoriq-410235fd4d20b8feaf8930a0575d23acc088aa87.tar.xz
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/cyclades.c')
-rw-r--r--drivers/tty/cyclades.c6
1 files changed, 1 insertions, 5 deletions
diff --git a/drivers/tty/cyclades.c b/drivers/tty/cyclades.c
index bc7b5a5..e61cabd 100644
--- a/drivers/tty/cyclades.c
+++ b/drivers/tty/cyclades.c
@@ -1515,13 +1515,9 @@ static void cy_shutdown(struct cyclades_port *info, struct tty_struct *tty)
static int cy_open(struct tty_struct *tty, struct file *filp)
{
struct cyclades_port *info;
- unsigned int i, line;
+ unsigned int i, line = tty->index;
int retval;
- line = tty->index;
- if (tty->index < 0 || NR_PORTS <= line)
- return -ENODEV;
-
for (i = 0; i < NR_CARDS; i++)
if (line < cy_card[i].first_line + cy_card[i].nports &&
line >= cy_card[i].first_line)