From: Qinglang Miao <miaoqinglang@huawei.com>
To: Linus Walleij <linus.walleij@linaro.org>,
Lorenzo Pieralisi <lorenzo.pieralisi@arm.com>,
Rob Herring <robh@kernel.org>,
Bjorn Helgaas <bhelgaas@google.com>
Cc: <linux-pci@vger.kernel.org>, <linux-kernel@vger.kernel.org>,
Qinglang Miao <miaoqinglang@huawei.com>
Subject: [PATCH] PCI: v3: fix missing clk_disable_unprepare() on error in v3_pci_probe
Date: Fri, 30 Oct 2020 09:34:27 +0800 [thread overview]
Message-ID: <20201030013427.54086-1-miaoqinglang@huawei.com> (raw)
Fix the missing clk_disable_unprepare() before return
from v3_pci_probe() in the error handling case.
Signed-off-by: Qinglang Miao <miaoqinglang@huawei.com>
---
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
next reply other threads:[~2020-10-30 1:28 UTC|newest]
Thread overview: 3+ messages / expand[flat|nested] mbox.gz Atom feed top
2020-10-30 1:34 Qinglang Miao [this message]
2020-11-02 13:48 ` [PATCH] PCI: v3: fix missing clk_disable_unprepare() on error in v3_pci_probe Rob Herring
2020-11-03 7:27 ` miaoqinglang
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20201030013427.54086-1-miaoqinglang@huawei.com \
--to=miaoqinglang@huawei.com \
--cc=bhelgaas@google.com \
--cc=linus.walleij@linaro.org \
--cc=linux-kernel@vger.kernel.org \
--cc=linux-pci@vger.kernel.org \
--cc=lorenzo.pieralisi@arm.com \
--cc=robh@kernel.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).