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>
这个提交包含在:
@@ -4105,20 +4105,11 @@ static int
|
||||
rs_open(struct tty_struct *tty, struct file * filp)
|
||||
{
|
||||
struct e100_serial *info;
|
||||
int retval, line;
|
||||
int retval;
|
||||
unsigned long page;
|
||||
int allocated_resources = 0;
|
||||
|
||||
/* find which port we want to open */
|
||||
line = tty->index;
|
||||
|
||||
if (line < 0 || line >= NR_PORTS)
|
||||
return -ENODEV;
|
||||
|
||||
/* find the corresponding e100_serial struct in the table */
|
||||
info = rs_table + line;
|
||||
|
||||
/* don't allow the opening of ports that are not enabled in the HW config */
|
||||
info = rs_table + tty->index;
|
||||
if (!info->enabled)
|
||||
return -ENODEV;
|
||||
|
||||
@@ -4131,7 +4122,7 @@ rs_open(struct tty_struct *tty, struct file * filp)
|
||||
tty->driver_data = info;
|
||||
info->port.tty = tty;
|
||||
|
||||
info->port.tty->low_latency = (info->flags & ASYNC_LOW_LATENCY) ? 1 : 0;
|
||||
tty->low_latency = !!(info->flags & ASYNC_LOW_LATENCY);
|
||||
|
||||
if (!tmp_buf) {
|
||||
page = get_zeroed_page(GFP_KERNEL);
|
||||
|
在新工单中引用
屏蔽一个用户