From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-9.0 required=3.0 tests=HEADER_FROM_DIFFERENT_DOMAINS, INCLUDES_PATCH,MAILING_LIST_MULTI,SIGNED_OFF_BY,SPF_PASS,USER_AGENT_GIT autolearn=ham autolearn_force=no version=3.4.0 Received: from mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id 05847C43381 for ; Fri, 8 Mar 2019 14:10:36 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.kernel.org (Postfix) with ESMTP id D1C62208E4 for ; Fri, 8 Mar 2019 14:10:35 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1726814AbfCHOKe (ORCPT ); Fri, 8 Mar 2019 09:10:34 -0500 Received: from szxga06-in.huawei.com ([45.249.212.32]:36586 "EHLO huawei.com" rhost-flags-OK-OK-OK-FAIL) by vger.kernel.org with ESMTP id S1726294AbfCHOKe (ORCPT ); Fri, 8 Mar 2019 09:10:34 -0500 Received: from DGGEMS405-HUB.china.huawei.com (unknown [172.30.72.58]) by Forcepoint Email with ESMTP id E6D3B46401562D04D656; Fri, 8 Mar 2019 22:10:30 +0800 (CST) Received: from localhost.localdomain.localdomain (10.175.113.25) by DGGEMS405-HUB.china.huawei.com (10.3.19.205) with Microsoft SMTP Server id 14.3.408.0; Fri, 8 Mar 2019 22:10:25 +0800 From: Mao Wenan To: , , , , Subject: [PATCH] serial: sh-sci: Missing uart_unregister_driver() on error in sci_probe_single() Date: Fri, 8 Mar 2019 22:23:10 +0800 Message-ID: <20190308142310.112914-1-maowenan@huawei.com> X-Mailer: git-send-email 2.20.1 MIME-Version: 1.0 Content-Transfer-Encoding: 7BIT Content-Type: text/plain; charset=US-ASCII X-Originating-IP: [10.175.113.25] X-CFilter-Loop: Reflected Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Add the missing uart_unregister_driver() before return from sci_probe_single() in the error handling case. Signed-off-by: Mao Wenan --- drivers/tty/serial/sh-sci.c | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/drivers/tty/serial/sh-sci.c b/drivers/tty/serial/sh-sci.c index 64bbeb7d7e0c..dde4eac9d222 100644 --- a/drivers/tty/serial/sh-sci.c +++ b/drivers/tty/serial/sh-sci.c @@ -3254,8 +3254,10 @@ static int sci_probe_single(struct platform_device *dev, mutex_unlock(&sci_uart_registration_lock); ret = sci_init_single(dev, sciport, index, p, false); - if (ret) + if (ret) { + uart_unregister_driver(&sci_uart_driver); return ret; + } sciport->gpios = mctrl_gpio_init(&sciport->port, 0); if (IS_ERR(sciport->gpios) && PTR_ERR(sciport->gpios) != -ENOSYS) -- 2.20.1