From patchwork Tue Oct 25 13:07:51 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Yang Yingliang X-Patchwork-Id: 13019233 X-Patchwork-Delegate: kuba@kernel.org 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 1BC59C38A2D for ; Tue, 25 Oct 2022 13:09:14 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S232245AbiJYNJM (ORCPT ); Tue, 25 Oct 2022 09:09:12 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:55022 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S232401AbiJYNJE (ORCPT ); Tue, 25 Oct 2022 09:09:04 -0400 Received: from szxga02-in.huawei.com (szxga02-in.huawei.com [45.249.212.188]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 319A26171A for ; Tue, 25 Oct 2022 06:09:01 -0700 (PDT) Received: from dggpemm500020.china.huawei.com (unknown [172.30.72.57]) by szxga02-in.huawei.com (SkyGuard) with ESMTP id 4MxXFn49WFzVj2d; Tue, 25 Oct 2022 21:04:13 +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.31; Tue, 25 Oct 2022 21:08:59 +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.31; Tue, 25 Oct 2022 21:08:59 +0800 From: Yang Yingliang To: CC: , , Subject: [PATCH net v2] net: fealnx: fix missing pci_disable_device() Date: Tue, 25 Oct 2022 21:07:51 +0800 Message-ID: <20221025130751.1075684-1-yangyingliang@huawei.com> X-Mailer: git-send-email 2.25.1 MIME-Version: 1.0 X-Originating-IP: [10.175.103.91] X-ClientProxiedBy: dggems702-chm.china.huawei.com (10.3.19.179) To dggpemm500007.china.huawei.com (7.185.36.183) X-CFilter-Loop: Reflected Precedence: bulk List-ID: X-Mailing-List: netdev@vger.kernel.org X-Patchwork-Delegate: kuba@kernel.org Add missing pci_disable_device() in error path of probe() and remove() path. Fixes: 1da177e4c3f4 ("Linux-2.6.12-rc2") Suggested-by: Leon Romanovsky Signed-off-by: Yang Yingliang --- v1 -> v2: Don't use pcim_enable_device(), call pci_disable_device() directly. --- drivers/net/ethernet/fealnx.c | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/drivers/net/ethernet/fealnx.c b/drivers/net/ethernet/fealnx.c index ed18450fd2cc..d72256391d49 100644 --- a/drivers/net/ethernet/fealnx.c +++ b/drivers/net/ethernet/fealnx.c @@ -502,7 +502,8 @@ static int fealnx_init_one(struct pci_dev *pdev, if (len < MIN_REGION_SIZE) { dev_err(&pdev->dev, "region size %ld too small, aborting\n", len); - return -ENODEV; + err = -ENODEV; + goto err_out_disable; } i = pci_request_regions(pdev, boardname); @@ -671,6 +672,8 @@ static int fealnx_init_one(struct pci_dev *pdev, pci_iounmap(pdev, ioaddr); err_out_res: pci_release_regions(pdev); +err_out_disable: + pci_disable_device(pdev); return err; } @@ -690,6 +693,7 @@ static void fealnx_remove_one(struct pci_dev *pdev) pci_iounmap(pdev, np->mem); free_netdev(dev); pci_release_regions(pdev); + pci_disable_device(pdev); } else printk(KERN_ERR "fealnx: remove for unknown device\n"); }