> +     if (cmd == MOXA_SET_SPECIAL_BAUD_RATE) {
> +             int speed;
> +
> +             if (get_user(speed, (int __user *)argp))
> +                     return -EFAULT;
> +             if (speed <= 0 || speed > info->max_baud)
> +                     return -EFAULT;

-EINVAL

> +             if (!info->tty || !info->tty->termios || !info->ioaddr)
> +                     return 0;

!info->tty and !info->tty->termios can't happen

> +             info->tty->termios->c_cflag &= ~(CBAUD | CBAUDEX);

No...

> +             for (i = 0; i < BAUD_TABLE_NO; i++)
> +                     if (speed == mxvar_baud_table[i])
> +                             break;
> +             if (i == BAUD_TABLE_NO) {
> +                     info->tty->termios->c_cflag |= B_SPEC;
> +             } else if (speed != 0)
> +                     info->tty->termios->c_cflag |= mxvar_baud_table1[i];

Replace all the above mess with a single tty_encode_baud_rate call

--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to [EMAIL PROTECTED]
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/

Reply via email to