Received: by 2002:a05:6a10:9e8c:0:0:0:0 with SMTP id y12csp913530pxx; Thu, 29 Oct 2020 18:30:46 -0700 (PDT) X-Google-Smtp-Source: ABdhPJxAF3Lc9R8oFAh4AZzjSh/RVSkunHI/VaRAF8ioLbVrwV2LTjCSTC8iXjLVehHW8k3lN9pg X-Received: by 2002:a17:906:4b12:: with SMTP id y18mr131907eju.533.1604021446378; Thu, 29 Oct 2020 18:30:46 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1604021446; cv=none; d=google.com; s=arc-20160816; b=BoMWgI+6jimPg2eCKKc7nlL29aOh5uNpHebZjQ9UGfsyitqja+bfYkPOoZd/9VkZgi fW4byVN+GMh6g57nqBPnEvRd+LMRgpJkcoFmGU5ANglHHE5Ff56Eo1cD4av4esrCGGZH Jcd6CNOWpfAkLSMks/j/RF9/6AyfcKLyupZo7AyAdUVXlLSGxSfuyhfU373E1cIudGpX CqiKujw/B6kuqH5qXniVPy3TW3o0l+pvjY9v8EXC0c4BIbwdRUU3L24SCZzQS/hdjtXn vbi2zDFmIwMrTgQwBXvJDkbR/70AjmN6C0SFkU5Cy/bwrrS9IlOmTNKEKl7D9me8Hdl/ IBtg== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:mime-version :message-id:date:subject:cc:to:from; bh=a34JAI8I9Nc8wfn4RSIjxcZ+TuCJH3vkp4DqhLPj1NA=; b=HqiNDnvxOTG9meOmez97YJoZnrJUoIjK338CkPUpQTw4b18Zomv/zDTzMP4uP6/wNy 02sk7AwS7bSoUFKW11dMs7jNFbjgFHCfFbtN21rejAIErxGA3wPQ9Ije4GSkf8CvnyIa 1bBLj3Y6+80w9O/6caw5KHzKVLtYI0MvVn00bCa/EStlR3z9dG6UaTpm/uO067ok73JY N5scRGXIw4RSp2DCtV3yBox+zn6UspcKbAq6WiUR1OZXZOyJJJZRkVxXBxSBR1ec2pjZ 8WgJRgeVkfwZu/FpFSE/NlMy5zqEaN3OFuSgHfWQITtDrrp7llbV5Jp1UWMVwHRFV1Rv Nx9w== ARC-Authentication-Results: i=1; mx.google.com; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id r21si3879487ejo.534.2020.10.29.18.30.24; Thu, 29 Oct 2020 18:30:46 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) client-ip=23.128.96.18; Authentication-Results: mx.google.com; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1726214AbgJ3B2u (ORCPT + 99 others); Thu, 29 Oct 2020 21:28:50 -0400 Received: from szxga07-in.huawei.com ([45.249.212.35]:6935 "EHLO szxga07-in.huawei.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1726149AbgJ3B2q (ORCPT ); Thu, 29 Oct 2020 21:28:46 -0400 Received: from DGGEMS413-HUB.china.huawei.com (unknown [172.30.72.58]) by szxga07-in.huawei.com (SkyGuard) with ESMTP id 4CMl7y5LW8z6xWj; Fri, 30 Oct 2020 09:28:46 +0800 (CST) Received: from localhost.localdomain.localdomain (10.175.113.25) by DGGEMS413-HUB.china.huawei.com (10.3.19.213) with Microsoft SMTP Server id 14.3.487.0; Fri, 30 Oct 2020 09:28:36 +0800 From: Qinglang Miao To: Linus Walleij , Lorenzo Pieralisi , Rob Herring , Bjorn Helgaas CC: , , Qinglang Miao Subject: [PATCH] PCI: v3: fix missing clk_disable_unprepare() on error in v3_pci_probe Date: Fri, 30 Oct 2020 09:34:27 +0800 Message-ID: <20201030013427.54086-1-miaoqinglang@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 Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Fix the missing clk_disable_unprepare() before return from v3_pci_probe() in the error handling case. Signed-off-by: Qinglang Miao --- drivers/pci/controller/pci-v3-semi.c | 14 +++++++++++--- 1 file changed, 11 insertions(+), 3 deletions(-) diff --git a/drivers/pci/controller/pci-v3-semi.c b/drivers/pci/controller/pci-v3-semi.c index 154a53986..e24abc5b4 100644 --- a/drivers/pci/controller/pci-v3-semi.c +++ b/drivers/pci/controller/pci-v3-semi.c @@ -739,8 +739,10 @@ static int v3_pci_probe(struct platform_device *pdev) regs = platform_get_resource(pdev, IORESOURCE_MEM, 0); v3->base = devm_ioremap_resource(dev, regs); - if (IS_ERR(v3->base)) + if (IS_ERR(v3->base)) { + clk_disable_unprepare(clk); return PTR_ERR(v3->base); + } /* * The hardware has a register with the physical base address * of the V3 controller itself, verify that this is the same @@ -754,17 +756,22 @@ static int v3_pci_probe(struct platform_device *pdev) regs = platform_get_resource(pdev, IORESOURCE_MEM, 1); if (resource_size(regs) != SZ_16M) { dev_err(dev, "config mem is not 16MB!\n"); + clk_disable_unprepare(clk); return -EINVAL; } v3->config_mem = regs->start; v3->config_base = devm_ioremap_resource(dev, regs); - if (IS_ERR(v3->config_base)) + if (IS_ERR(v3->config_base)) { + clk_disable_unprepare(clk); return PTR_ERR(v3->config_base); + } /* Get and request error IRQ resource */ irq = platform_get_irq(pdev, 0); - if (irq < 0) + if (irq < 0) { + clk_disable_unprepare(clk); return irq; + } ret = devm_request_irq(dev, irq, v3_irq, 0, "PCIv3 error", v3); @@ -772,6 +779,7 @@ static int v3_pci_probe(struct platform_device *pdev) dev_err(dev, "unable to request PCIv3 error IRQ %d (%d)\n", irq, ret); + clk_disable_unprepare(clk); return ret; } -- 2.23.0