Skip to content

Commit

Permalink
tty: Fix an ircomm warning and note another bug
Browse files Browse the repository at this point in the history
Roel Kluin noted that line is unsigned so one test is unneccessary. Also
add a warning for another flaw I noticed while making this change.

Signed-off-by: Alan Cox <[email protected]>
Signed-off-by: Linus Torvalds <[email protected]>
  • Loading branch information
Alan Cox authored and torvalds committed Jan 2, 2009
1 parent c847d47 commit ad36b88
Showing 1 changed file with 3 additions and 2 deletions.
5 changes: 3 additions & 2 deletions net/irda/ircomm/ircomm_tty.c
Original file line number Diff line number Diff line change
Expand Up @@ -371,9 +371,8 @@ static int ircomm_tty_open(struct tty_struct *tty, struct file *filp)
IRDA_DEBUG(2, "%s()\n", __func__ );

line = tty->index;
if ((line < 0) || (line >= IRCOMM_TTY_PORTS)) {
if (line >= IRCOMM_TTY_PORTS)
return -ENODEV;
}

/* Check if instance already exists */
self = hashbin_lock_find(ircomm_tty, line, NULL);
Expand Down Expand Up @@ -405,6 +404,8 @@ static int ircomm_tty_open(struct tty_struct *tty, struct file *filp)
* Force TTY into raw mode by default which is usually what
* we want for IrCOMM and IrLPT. This way applications will
* not have to twiddle with printcap etc.
*
* Note this is completely usafe and doesn't work properly
*/
tty->termios->c_iflag = 0;
tty->termios->c_oflag = 0;
Expand Down

0 comments on commit ad36b88

Please sign in to comment.