Re: [PATCH 09/50] amiserial: switch to ->[sg]et_serial()

From: Geert Uytterhoeven
Date: Thu Oct 11 2018 - 13:58:44 EST


Hi Al,

On Thu, Sep 13, 2018 at 4:45 AM Al Viro <viro@xxxxxxxxxxxxxxxxxx> wrote:
> From: Al Viro <viro@xxxxxxxxxxxxxxxxxx>
>
> Signed-off-by: Al Viro <viro@xxxxxxxxxxxxxxxxxx>

> --- a/drivers/tty/amiserial.c
> +++ b/drivers/tty/amiserial.c

> -static int set_serial_info(struct tty_struct *tty, struct serial_state *state,
> - struct serial_struct __user * new_info)
> +static int set_serial_info(struct tty_struct *tty, struct serial_struct *ss)
> {
> + struct serial_state *state = tty->driver_data;
> struct tty_port *port = &state->tport;
> - struct serial_struct new_serial;
> bool change_spd;
> - int retval = 0;

"retval" is still used...

>
> - if (copy_from_user(&new_serial,new_info,sizeof(new_serial)))
> - return -EFAULT;
> + if (serial_paranoia_check(state, tty->name, "rs_ioctl"))
> + return -ENODEV;
>
> tty_lock(tty);
> - change_spd = ((new_serial.flags ^ port->flags) & ASYNC_SPD_MASK) ||
> - new_serial.custom_divisor != state->custom_divisor;
> - if (new_serial.irq || new_serial.port != state->port ||
> - new_serial.xmit_fifo_size != state->xmit_fifo_size) {
> + change_spd = ((ss->flags ^ port->flags) & ASYNC_SPD_MASK) ||
> + ss->custom_divisor != state->custom_divisor;
> + if (ss->irq || ss->port != state->port ||
> + ss->xmit_fifo_size != state->xmit_fifo_size) {
> tty_unlock(tty);
> return -EINVAL;
> }
>
> if (!serial_isroot()) {
> - if ((new_serial.baud_base != state->baud_base) ||
> - (new_serial.close_delay != port->close_delay) ||
> - (new_serial.xmit_fifo_size != state->xmit_fifo_size) ||
> - ((new_serial.flags & ~ASYNC_USR_MASK) !=
> + if ((ss->baud_base != state->baud_base) ||
> + (ss->close_delay != port->close_delay) ||
> + (ss->xmit_fifo_size != state->xmit_fifo_size) ||
> + ((ss->flags & ~ASYNC_USR_MASK) !=
> (port->flags & ~ASYNC_USR_MASK))) {
> tty_unlock(tty);
> return -EPERM;
> }
> port->flags = ((port->flags & ~ASYNC_USR_MASK) |
> - (new_serial.flags & ASYNC_USR_MASK));
> - state->custom_divisor = new_serial.custom_divisor;
> + (ss->flags & ASYNC_USR_MASK));
> + state->custom_divisor = ss->custom_divisor;
> goto check_and_exit;
> }
>
> - if (new_serial.baud_base < 9600) {
> + if (ss->baud_base < 9600) {
> tty_unlock(tty);
> return -EINVAL;
> }
> @@ -1062,19 +1059,19 @@ static int set_serial_info(struct tty_struct *tty, struct serial_state *state,
> * At this point, we start making changes.....
> */
>
> - state->baud_base = new_serial.baud_base;
> + state->baud_base = ss->baud_base;
> port->flags = ((port->flags & ~ASYNC_FLAGS) |
> - (new_serial.flags & ASYNC_FLAGS));
> - state->custom_divisor = new_serial.custom_divisor;
> - port->close_delay = new_serial.close_delay * HZ/100;
> - port->closing_wait = new_serial.closing_wait * HZ/100;
> + (ss->flags & ASYNC_FLAGS));
> + state->custom_divisor = ss->custom_divisor;
> + port->close_delay = ss->close_delay * HZ/100;
> + port->closing_wait = ss->closing_wait * HZ/100;
> port->low_latency = (port->flags & ASYNC_LOW_LATENCY) ? 1 : 0;
>
> check_and_exit:
> if (tty_port_initialized(port)) {
> if (change_spd) {
> /* warn about deprecation unless clearing */
> - if (new_serial.flags & ASYNC_SPD_MASK)
> + if (ss->flags & ASYNC_SPD_MASK)
> dev_warn_ratelimited(tty->dev, "use of SPD flags is deprecated\n");
> change_speed(tty, state, NULL);
> }
> @@ -1084,7 +1081,6 @@ static int set_serial_info(struct tty_struct *tty, struct serial_state *state,
> return retval;

... here, and in the line above (out of context). leading to

drivers/tty/amiserial.c:1076:3: error: 'retval' undeclared (first use
in this function)

http://kisskb.ellerman.id.au/kisskb/buildresult/13544535/
http://kisskb.ellerman.id.au/kisskb/buildresult/13544413/

Gr{oetje,eeting}s,

Geert

--
Geert Uytterhoeven -- There's lots of Linux beyond ia32 -- geert@xxxxxxxxxxxxxx

In personal conversations with technical people, I call myself a hacker. But
when I'm talking to journalists I just say "programmer" or something like that.
-- Linus Torvalds