From: Alex Elder Date: Mon, 18 Aug 2014 23:25:12 +0000 (-0500) Subject: greybus: uart-gb: a few minor bug fixes X-Git-Tag: v4.14-rc1~2366^2~378^2~21^2~2180 X-Git-Url: http://review.tizen.org/git/?a=commitdiff_plain;h=caaa8a838dd098fc72f393b871c3f882bfac9e77;p=platform%2Fkernel%2Flinux-rpi.git greybus: uart-gb: a few minor bug fixes 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 Signed-off-by: Greg Kroah-Hartman --- diff --git a/drivers/staging/greybus/uart-gb.c b/drivers/staging/greybus/uart-gb.c index 0e2507c..4a54e9e 100644 --- a/drivers/staging/greybus/uart-gb.c +++ b/drivers/staging/greybus/uart-gb.c @@ -286,7 +286,7 @@ static int wait_serial_change(struct gb_tty *gb_tty, unsigned long arg) 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 { @@ -294,7 +294,7 @@ static int wait_serial_change(struct gb_tty *gb_tty, unsigned long arg) 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; @@ -310,11 +310,9 @@ static int wait_serial_change(struct gb_tty *gb_tty, unsigned long arg) 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); @@ -429,6 +427,7 @@ static int tty_gb_probe(struct greybus_device *gdev, const struct greybus_device return 0; error: + greybus_set_drvdata(gdev, NULL); release_minor(gb_tty); return retval; }