mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
From: Yang Yingliang <yangyingliang@huawei.com>
To: <linux-kernel@vger.kernel.org>, <linux-serial@vger.kernel.org>
Cc: <gregkh@linuxfoundation.org>, <geert+renesas@glider.be>,
	<peter@hurleysoftware.com>, <sjoerd.simons@collabora.co.uk>
Subject: [PATCH 2/2] serial: sh-sci: fix missing uart_unregister_driver() in sci_probe_single()
Date: Thu, 30 Jun 2022 22:09:19 +0800	[thread overview]
Message-ID: <20220630140919.3857698-2-yangyingliang@huawei.com> (raw)
In-Reply-To: <20220630140919.3857698-1-yangyingliang@huawei.com>

Add missing uart_unregister_driver() in error case in sci_probe_single().

Fixes: 352b92664549 ("serial: sh-sci: Move uart_register_driver call to device probe")
Reported-by: Hulk Robot <hulkci@huawei.com>
Signed-off-by: Yang Yingliang <yangyingliang@huawei.com>
---
 drivers/tty/serial/sh-sci.c | 6 +++++-
 1 file changed, 5 insertions(+), 1 deletion(-)

diff --git a/drivers/tty/serial/sh-sci.c b/drivers/tty/serial/sh-sci.c
index ca5a58f01aff..08a249eaaa8c 100644
--- a/drivers/tty/serial/sh-sci.c
+++ b/drivers/tty/serial/sh-sci.c
@@ -3280,7 +3280,7 @@ static int sci_probe_single(struct platform_device *dev,
 
 	ret = sci_init_single(dev, sciport, index, p, false);
 	if (ret)
-		return ret;
+		goto err_unregister;
 
 	sciport->gpios = mctrl_gpio_init(&sciport->port, 0);
 	if (IS_ERR(sciport->gpios)) {
@@ -3306,6 +3306,10 @@ static int sci_probe_single(struct platform_device *dev,
 
 err_cleanup_single:
 	sci_cleanup_single(sciport);
+err_unregister:
+	mutex_lock(&sci_uart_registration_lock);
+	uart_unregister_driver(&sci_uart_driver);
+	mutex_unlock(&sci_uart_registration_lock);
 
 	return ret;
 }
-- 
2.25.1


  reply	other threads:[~2022-06-30 14:14 UTC|newest]

Thread overview: 7+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2022-06-30 14:09 [PATCH 1/2] serial: sh-sci: fix missing sci_cleanup_single() " Yang Yingliang
2022-06-30 14:09 ` Yang Yingliang [this message]
2022-06-30 15:13   ` [PATCH 2/2] serial: sh-sci: fix missing uart_unregister_driver() " Greg KH
2022-07-01  2:34     ` Yang Yingliang
2022-06-30 15:13 ` [PATCH 1/2] serial: sh-sci: fix missing sci_cleanup_single() " Greg KH
2022-07-01  4:25   ` Yang Yingliang
2022-07-07  8:47 ` Geert Uytterhoeven

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=20220630140919.3857698-2-yangyingliang@huawei.com \
    --to=yangyingliang@huawei.com \
    --cc=geert+renesas@glider.be \
    --cc=gregkh@linuxfoundation.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-serial@vger.kernel.org \
    --cc=peter@hurleysoftware.com \
    --cc=sjoerd.simons@collabora.co.uk \
    /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 a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox

all inboxes | Powered by JetHome®