From patchwork Fri May 6 09:40:39 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Yang Yingliang X-Patchwork-Id: 12840795 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 bombadil.infradead.org (bombadil.infradead.org [198.137.202.133]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.lore.kernel.org (Postfix) with ESMTPS id D8218C433F5 for ; Fri, 6 May 2022 09:30:26 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=lists.infradead.org; s=bombadil.20210309; h=Sender: Content-Transfer-Encoding:Content-Type:List-Subscribe:List-Help:List-Post: List-Archive:List-Unsubscribe:List-Id:MIME-Version:Message-ID:Date:Subject:CC :To:From:Reply-To:Content-ID:Content-Description:Resent-Date:Resent-From: Resent-Sender:Resent-To:Resent-Cc:Resent-Message-ID:In-Reply-To:References: List-Owner; bh=XU/ALW9Ux7/CVYF8G0H3PXIggEOfyFioXBnwQYqcJQY=; b=GMB2tGi/9DJEv/ 6uHWtcwHFWPneNukh1EDaRc2RdS03VZbPP/Gd7OIBNPqf2wTzB+n1Dp6SldDx/VaF0d+fCrggpI2x 0LOpyOmcMXfjSyLVUNyR3tESnhI+pWsn2PobG+qO0iLtcIu0pxpbliUTxRqcNBdh+ZFc4Z1S05sSA g/VfVFDhtAwF4Eq3ShNvfWOSSYiiuwWfflY546hjXh/FoCGcYsRXmpggqgkAMh9I6lbbaDrUNOLsy BtAjT7ozA25CiLB0rMJp6OixGkMLDF2c97yFEPJ3WdYFgAWF+MlWOm9sgUjYT2XxHnKu5LeNy+dIg BwX9mTFRd7bk7Ppvf8oA==; Received: from localhost ([::1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.94.2 #2 (Red Hat Linux)) id 1nmuGr-002LI0-Rv; Fri, 06 May 2022 09:29:09 +0000 Received: from szxga03-in.huawei.com ([45.249.212.189]) by bombadil.infradead.org with esmtps (Exim 4.94.2 #2 (Red Hat Linux)) id 1nmuGn-002LFi-JP for linux-arm-kernel@lists.infradead.org; Fri, 06 May 2022 09:29:07 +0000 Received: from dggpemm500024.china.huawei.com (unknown [172.30.72.57]) by szxga03-in.huawei.com (SkyGuard) with ESMTP id 4KvlWN1xJ8zVfqG; Fri, 6 May 2022 17:24:16 +0800 (CST) Received: from dggpemm500007.china.huawei.com (7.185.36.183) by dggpemm500024.china.huawei.com (7.185.36.203) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256) id 15.1.2375.24; Fri, 6 May 2022 17:28:58 +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; Fri, 6 May 2022 17:28:57 +0800 From: Yang Yingliang To: , , , CC: , , , , Subject: [PATCH] net: stmmac: fix missing pci_disable_device() on error in stmmac_pci_probe() Date: Fri, 6 May 2022 17:40:39 +0800 Message-ID: <20220506094039.3629649-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: dggems701-chm.china.huawei.com (10.3.19.178) To dggpemm500007.china.huawei.com (7.185.36.183) X-CFilter-Loop: Reflected X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20220506_022905_861641_F6E4C2DD X-CRM114-Status: UNSURE ( 8.65 ) X-CRM114-Notice: Please train this message. X-BeenThere: linux-arm-kernel@lists.infradead.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Sender: "linux-arm-kernel" Errors-To: linux-arm-kernel-bounces+linux-arm-kernel=archiver.kernel.org@lists.infradead.org Fix the missing pci_disable_device() before return from stmmac_pci_probe() in the error handling case. Reported-by: Hulk Robot Signed-off-by: Yang Yingliang --- drivers/net/ethernet/stmicro/stmmac/stmmac_pci.c | 15 ++++++++++++--- 1 file changed, 12 insertions(+), 3 deletions(-) diff --git a/drivers/net/ethernet/stmicro/stmmac/stmmac_pci.c b/drivers/net/ethernet/stmicro/stmmac/stmmac_pci.c index fcf17d8a0494..02bddc05a34f 100644 --- a/drivers/net/ethernet/stmicro/stmmac/stmmac_pci.c +++ b/drivers/net/ethernet/stmicro/stmmac/stmmac_pci.c @@ -194,7 +194,7 @@ static int stmmac_pci_probe(struct pci_dev *pdev, continue; ret = pcim_iomap_regions(pdev, BIT(i), pci_name(pdev)); if (ret) - return ret; + goto err_out_disable_device; break; } @@ -202,7 +202,7 @@ static int stmmac_pci_probe(struct pci_dev *pdev, ret = info->setup(pdev, plat); if (ret) - return ret; + goto err_out_disable_device; memset(&res, 0, sizeof(res)); res.addr = pcim_iomap_table(pdev)[i]; @@ -219,7 +219,16 @@ static int stmmac_pci_probe(struct pci_dev *pdev, plat->safety_feat_cfg->prtyen = 1; plat->safety_feat_cfg->tmouten = 1; - return stmmac_dvr_probe(&pdev->dev, plat, &res); + ret = stmmac_dvr_probe(&pdev->dev, plat, &res); + if (ret) + goto err_out_disable_device; + + return 0; + +err_out_disable_device: + pci_disable_device(pdev); + + return ret; } /**