From patchwork Thu Jun 30 14:09:19 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Yang Yingliang X-Patchwork-Id: 586285 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id 97D85C433EF for ; Thu, 30 Jun 2022 14:14:10 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S237127AbiF3OOI (ORCPT ); Thu, 30 Jun 2022 10:14:08 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:40462 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S236932AbiF3ONp (ORCPT ); Thu, 30 Jun 2022 10:13:45 -0400 Received: from szxga08-in.huawei.com (szxga08-in.huawei.com [45.249.212.255]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 7FB013EAB8; Thu, 30 Jun 2022 06:59:34 -0700 (PDT) Received: from dggpemm500020.china.huawei.com (unknown [172.30.72.53]) by szxga08-in.huawei.com (SkyGuard) with ESMTP id 4LYfyv32NDz1L8fD; Thu, 30 Jun 2022 21:57:11 +0800 (CST) Received: from dggpemm500007.china.huawei.com (7.185.36.183) by dggpemm500020.china.huawei.com (7.185.36.49) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256) id 15.1.2375.24; Thu, 30 Jun 2022 21:59:29 +0800 Received: from huawei.com (10.175.103.91) by dggpemm500007.china.huawei.com (7.185.36.183) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256) id 15.1.2375.24; Thu, 30 Jun 2022 21:59:28 +0800 From: Yang Yingliang To: , CC: , , , 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 Message-ID: <20220630140919.3857698-2-yangyingliang@huawei.com> X-Mailer: git-send-email 2.25.1 In-Reply-To: <20220630140919.3857698-1-yangyingliang@huawei.com> References: <20220630140919.3857698-1-yangyingliang@huawei.com> MIME-Version: 1.0 X-Originating-IP: [10.175.103.91] X-ClientProxiedBy: dggems704-chm.china.huawei.com (10.3.19.181) To dggpemm500007.china.huawei.com (7.185.36.183) X-CFilter-Loop: Reflected Precedence: bulk List-ID: X-Mailing-List: linux-serial@vger.kernel.org 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 Signed-off-by: Yang Yingliang --- 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; }