From nobody Fri Dec 19 17:10:36 2025 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 EC467ECAAD8 for ; Fri, 23 Sep 2022 09:30:42 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S231772AbiIWJak (ORCPT ); Fri, 23 Sep 2022 05:30:40 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:41990 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S231666AbiIWJaD (ORCPT ); Fri, 23 Sep 2022 05:30:03 -0400 Received: from szxga03-in.huawei.com (szxga03-in.huawei.com [45.249.212.189]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 96E36F5959 for ; Fri, 23 Sep 2022 02:29:21 -0700 (PDT) Received: from kwepemi500008.china.huawei.com (unknown [172.30.72.56]) by szxga03-in.huawei.com (SkyGuard) with ESMTP id 4MYmy41hl2zHplr; Fri, 23 Sep 2022 17:27:08 +0800 (CST) Received: from huawei.com (10.67.175.83) by kwepemi500008.china.huawei.com (7.221.188.139) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256) id 15.1.2375.31; Fri, 23 Sep 2022 17:29:19 +0800 From: ruanjinjie To: , , CC: Subject: [PATCH -next] tty: moxa: add missing pci_disable_device() Date: Fri, 23 Sep 2022 17:25:30 +0800 Message-ID: <20220923092530.3088080-1-ruanjinjie@huawei.com> X-Mailer: git-send-email 2.25.1 MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable X-Originating-IP: [10.67.175.83] X-ClientProxiedBy: dggems704-chm.china.huawei.com (10.3.19.181) To kwepemi500008.china.huawei.com (7.221.188.139) X-CFilter-Loop: Reflected Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Type: text/plain; charset="utf-8" Driver should call pci_disable_device() if it returns from moxa_pci_probe() with error. Meanwhile, the driver calls pci_enable_device() in moxa_pci_probe(), but never calls pci_disable_device() during removal. Signed-off-by: ruanjinjie --- drivers/tty/moxa.c | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/drivers/tty/moxa.c b/drivers/tty/moxa.c index 35b6fddf0341..9174b64ea2db 100644 --- a/drivers/tty/moxa.c +++ b/drivers/tty/moxa.c @@ -1239,7 +1239,7 @@ static int moxa_pci_probe(struct pci_dev *pdev, retval =3D pci_enable_device(pdev); if (retval) { dev_err(&pdev->dev, "can't enable pci device\n"); - goto err; + return retval; } =20 for (i =3D 0; i < MAX_BOARDS; i++) @@ -1300,6 +1300,7 @@ static int moxa_pci_probe(struct pci_dev *pdev, err_reg: pci_release_region(pdev, 2); err: + pci_disable_device(pdev); return retval; } =20 @@ -1310,6 +1311,7 @@ static void moxa_pci_remove(struct pci_dev *pdev) moxa_board_deinit(brd); =20 pci_release_region(pdev, 2); + pci_disable_device(pdev); } =20 static struct pci_driver moxa_pci_driver =3D { --=20 2.25.1