Here are a few small bug fixes in uart-gb.c:
- In wait_serial_change():
- Return -EINVAL if *none* of the relevant flags are set in
the "arg" parameter.
- Balance the spin_lock_irq() with an unlock call (not
another lock).
- Rearrange a nested if structure (not a bug fix).
- In tty_gb_probe():
- Reset the greybus_device driver data in case of error.
Signed-off-by: Alex Elder <elder@linaro.org>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
struct async_icount old;
struct async_icount new;
- if (arg & (TIOCM_DSR | TIOCM_RI | TIOCM_CD))
+ if (!(arg & (TIOCM_DSR | TIOCM_RI | TIOCM_CD)))
return -EINVAL;
do {
old = gb_tty->oldcount;
new = gb_tty->iocount;
gb_tty->oldcount = new;
- spin_lock_irq(&gb_tty->read_lock);
+ spin_unlock_irq(&gb_tty->read_lock);
if ((arg & TIOCM_DSR) && (old.dsr != new.dsr))
break;
if (gb_tty->disconnected) {
if (arg & TIOCM_CD)
break;
- else
- retval = -ENODEV;
- } else {
- if (signal_pending(current))
- retval = -ERESTARTSYS;
+ retval = -ENODEV;
+ } else if (signal_pending(current)) {
+ retval = -ERESTARTSYS;
}
} while (!retval);
return 0;
error:
+ greybus_set_drvdata(gdev, NULL);
release_minor(gb_tty);
return retval;
}