All of lore.kernel.org
 help / color / mirror / Atom feed
From: Dan Carpenter <dan.carpenter@oracle.com>
To: Greg Kroah-Hartman <gregkh@linuxfoundation.org>,
	Yegor Yefremov <yegorslists@googlemail.com>
Cc: Jiri Slaby <jslaby@suse.com>,
	Andy Shevchenko <andriy.shevchenko@linux.intel.com>,
	Anton Wuerfel <anton.wuerfel@fau.de>,
	Phillip Raffeck <phillip.raffeck@fau.de>,
	Peter Hurley <peter@hurleysoftware.com>,
	Wan Ahmad Zainie <wan.ahmad.zainie.wan.mohamad@intel.com>,
	Masahiro Yamada <yamada.masahiro@socionext.com>,
	"Maciej S. Szmigiero" <mail@maciej.szmigiero.name>,
	linux-serial@vger.kernel.org, kernel-janitors@vger.kernel.org
Subject: [patch] tty/serial/8250: unlock on error in serial8250_register_8250_port()
Date: Tue, 28 Jun 2016 09:15:22 +0000	[thread overview]
Message-ID: <20160628091522.GA7720@mwanda> (raw)

We need to unlock before returning here.

Fixes: 4ef03d328769 ('tty/serial/8250: use mctrl_gpio helpers')
Signed-off-by: Dan Carpenter <dan.carpenter@oracle.com>

diff --git a/drivers/tty/serial/8250/8250_core.c b/drivers/tty/serial/8250/8250_core.c
index 13ad5c3..a2b849e 100644
--- a/drivers/tty/serial/8250/8250_core.c
+++ b/drivers/tty/serial/8250/8250_core.c
@@ -1015,8 +1015,10 @@ int serial8250_register_8250_port(struct uart_8250_port *up)
 
 		gpios = mctrl_gpio_init(&uart->port, 0);
 		if (IS_ERR(gpios)) {
-			if (PTR_ERR(gpios) != -ENOSYS)
-				return PTR_ERR(gpios);
+			if (PTR_ERR(gpios) != -ENOSYS) {
+				ret = PTR_ERR(gpios);
+				goto unlock;
+			}
 		} else
 			uart->gpios = gpios;
 
@@ -1068,6 +1070,7 @@ int serial8250_register_8250_port(struct uart_8250_port *up)
 			ret = 0;
 		}
 	}
+unlock:
 	mutex_unlock(&serial_mutex);
 
 	return ret;

WARNING: multiple messages have this Message-ID (diff)
From: Dan Carpenter <dan.carpenter@oracle.com>
To: Greg Kroah-Hartman <gregkh@linuxfoundation.org>,
	Yegor Yefremov <yegorslists@googlemail.com>
Cc: Jiri Slaby <jslaby@suse.com>,
	Andy Shevchenko <andriy.shevchenko@linux.intel.com>,
	Anton Wuerfel <anton.wuerfel@fau.de>,
	Phillip Raffeck <phillip.raffeck@fau.de>,
	Peter Hurley <peter@hurleysoftware.com>,
	Wan Ahmad Zainie <wan.ahmad.zainie.wan.mohamad@intel.com>,
	Masahiro Yamada <yamada.masahiro@socionext.com>,
	"Maciej S. Szmigiero" <mail@maciej.szmigiero.name>,
	linux-serial@vger.kernel.org, kernel-janitors@vger.kernel.org
Subject: [patch] tty/serial/8250: unlock on error in serial8250_register_8250_port()
Date: Tue, 28 Jun 2016 12:15:22 +0300	[thread overview]
Message-ID: <20160628091522.GA7720@mwanda> (raw)

We need to unlock before returning here.

Fixes: 4ef03d328769 ('tty/serial/8250: use mctrl_gpio helpers')
Signed-off-by: Dan Carpenter <dan.carpenter@oracle.com>

diff --git a/drivers/tty/serial/8250/8250_core.c b/drivers/tty/serial/8250/8250_core.c
index 13ad5c3..a2b849e 100644
--- a/drivers/tty/serial/8250/8250_core.c
+++ b/drivers/tty/serial/8250/8250_core.c
@@ -1015,8 +1015,10 @@ int serial8250_register_8250_port(struct uart_8250_port *up)
 
 		gpios = mctrl_gpio_init(&uart->port, 0);
 		if (IS_ERR(gpios)) {
-			if (PTR_ERR(gpios) != -ENOSYS)
-				return PTR_ERR(gpios);
+			if (PTR_ERR(gpios) != -ENOSYS) {
+				ret = PTR_ERR(gpios);
+				goto unlock;
+			}
 		} else
 			uart->gpios = gpios;
 
@@ -1068,6 +1070,7 @@ int serial8250_register_8250_port(struct uart_8250_port *up)
 			ret = 0;
 		}
 	}
+unlock:
 	mutex_unlock(&serial_mutex);
 
 	return ret;

             reply	other threads:[~2016-06-28  9:15 UTC|newest]

Thread overview: 6+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2016-06-28  9:15 Dan Carpenter [this message]
2016-06-28  9:15 ` [patch] tty/serial/8250: unlock on error in serial8250_register_8250_port() Dan Carpenter
2016-08-31 13:57 ` Greg Kroah-Hartman
2016-08-31 13:57   ` Greg Kroah-Hartman
2016-08-31 16:11   ` Andy Shevchenko
2016-08-31 16:11     ` Andy Shevchenko

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20160628091522.GA7720@mwanda \
    --to=dan.carpenter@oracle.com \
    --cc=andriy.shevchenko@linux.intel.com \
    --cc=anton.wuerfel@fau.de \
    --cc=gregkh@linuxfoundation.org \
    --cc=jslaby@suse.com \
    --cc=kernel-janitors@vger.kernel.org \
    --cc=linux-serial@vger.kernel.org \
    --cc=mail@maciej.szmigiero.name \
    --cc=peter@hurleysoftware.com \
    --cc=phillip.raffeck@fau.de \
    --cc=wan.ahmad.zainie.wan.mohamad@intel.com \
    --cc=yamada.masahiro@socionext.com \
    --cc=yegorslists@googlemail.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.