aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/isdn
diff options
context:
space:
mode:
authorJiri Slaby <jslaby@suse.cz>2012-03-05 08:52:01 -0500
committerGreg Kroah-Hartman <gregkh@linuxfoundation.org>2012-03-08 14:42:21 -0500
commit410235fd4d20b8feaf8930a0575d23acc088aa87 (patch)
treead21d071a29ef0ad400393328ca4ab0588d5b2b7 /drivers/isdn
parent44a1bfd95d0a6c0096e79a883197596e1ce83cc3 (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/isdn')
-rw-r--r--drivers/isdn/capi/capi.c3
-rw-r--r--drivers/isdn/gigaset/common.c2
-rw-r--r--drivers/isdn/i4l/isdn_tty.c7
3 files changed, 3 insertions, 9 deletions
diff --git a/drivers/isdn/capi/capi.c b/drivers/isdn/capi/capi.c
index baf08eba495c..3a7905b06e53 100644
--- a/drivers/isdn/capi/capi.c
+++ b/drivers/isdn/capi/capi.c
@@ -1013,8 +1013,7 @@ static const struct file_operations capi_fops =
1013static int 1013static int
1014capinc_tty_install(struct tty_driver *driver, struct tty_struct *tty) 1014capinc_tty_install(struct tty_driver *driver, struct tty_struct *tty)
1015{ 1015{
1016 int idx = tty->index; 1016 struct capiminor *mp = capiminor_get(tty->index);
1017 struct capiminor *mp = capiminor_get(idx);
1018 int ret = tty_standard_install(driver, tty); 1017 int ret = tty_standard_install(driver, tty);
1019 1018
1020 if (ret == 0) 1019 if (ret == 0)
diff --git a/drivers/isdn/gigaset/common.c b/drivers/isdn/gigaset/common.c
index db621db67f61..ac0186e54bf4 100644
--- a/drivers/isdn/gigaset/common.c
+++ b/drivers/isdn/gigaset/common.c
@@ -1051,8 +1051,6 @@ static struct cardstate *gigaset_get_cs_by_minor(unsigned minor)
1051 1051
1052struct cardstate *gigaset_get_cs_by_tty(struct tty_struct *tty) 1052struct cardstate *gigaset_get_cs_by_tty(struct tty_struct *tty)
1053{ 1053{
1054 if (tty->index < 0 || tty->index >= tty->driver->num)
1055 return NULL;
1056 return gigaset_get_cs_by_minor(tty->index + tty->driver->minor_start); 1054 return gigaset_get_cs_by_minor(tty->index + tty->driver->minor_start);
1057} 1055}
1058 1056
diff --git a/drivers/isdn/i4l/isdn_tty.c b/drivers/isdn/i4l/isdn_tty.c
index 2c26b64ebbea..ac4840124bc0 100644
--- a/drivers/isdn/i4l/isdn_tty.c
+++ b/drivers/isdn/i4l/isdn_tty.c
@@ -1590,12 +1590,9 @@ static int
1590isdn_tty_open(struct tty_struct *tty, struct file *filp) 1590isdn_tty_open(struct tty_struct *tty, struct file *filp)
1591{ 1591{
1592 modem_info *info; 1592 modem_info *info;
1593 int retval, line; 1593 int retval;
1594 1594
1595 line = tty->index; 1595 info = &dev->mdm.info[tty->index];
1596 if (line < 0 || line >= ISDN_MAX_CHANNELS)
1597 return -ENODEV;
1598 info = &dev->mdm.info[line];
1599 if (isdn_tty_paranoia_check(info, tty->name, "isdn_tty_open")) 1596 if (isdn_tty_paranoia_check(info, tty->name, "isdn_tty_open"))
1600 return -ENODEV; 1597 return -ENODEV;
1601 if (!try_module_get(info->owner)) { 1598 if (!try_module_get(info->owner)) {