[<prev] [next>] [<thread-prev] [day] [month] [year] [list]
Message-ID: <CAL_Jsq+KYEYKqRcYvdy3CN+qLDq7MmMsQeQ_=RZ8+TT97wkgiA@mail.gmail.com>
Date: Fri, 6 Nov 2020 16:40:23 -0600
From: Rob Herring <robh@...nel.org>
To: Qinglang Miao <miaoqinglang@...wei.com>
Cc: Linus Walleij <linus.walleij@...aro.org>,
Lorenzo Pieralisi <lorenzo.pieralisi@....com>,
Bjorn Helgaas <bhelgaas@...gle.com>,
PCI <linux-pci@...r.kernel.org>,
"linux-kernel@...r.kernel.org" <linux-kernel@...r.kernel.org>
Subject: Re: [PATCH v4] PCI: v3: fix missing clk_disable_unprepare() on error
in v3_pci_probe
On Thu, Nov 5, 2020 at 9:37 PM Qinglang Miao <miaoqinglang@...wei.com> wrote:
>
> Fix the missing clk_disable_unprepare() before return
> from v3_pci_probe() in the error handling case.
>
> I also move the clock-enable function later to avoid some
> fixes.
>
> Fixes: 68a15eb7bd0c ("PCI: v3-semi: Add V3 Semiconductor PCI host driver")
> Suggested-by: Rob Herring <robh@...nel.org>
> Signed-off-by: Qinglang Miao <miaoqinglang@...wei.com>
> ---
> v2: add commit causing this problem and add more error handling
> cases which are not enough.
> v3: 1. fix the wrong 'Fixes commit'.
> 2. use goto to clean up this patch.
> 3. cover all error handling cases.
> v4: fix uncorresponding author name.
> drivers/pci/controller/pci-v3-semi.c | 49 +++++++++++++++++-----------
> 1 file changed, 30 insertions(+), 19 deletions(-)
[...]
> @@ -889,7 +891,16 @@ static int v3_pci_probe(struct platform_device *pdev)
> val |= V3_SYSTEM_M_LOCK;
> writew(val, v3->base + V3_SYSTEM);
>
> - return pci_host_probe(host);
> + ret = pci_host_probe(host);
> + if (ret < 0)
> + goto err_clk;
> +
> + return 0;
Slightly simpler to do:
ret = pci_host_probe(host);
if (!ret)
return 0;
err_clk:
With that,
Reviewed-by: Rob Herring <robh@...nel.org>
> +
> +err_clk:
> + clk_disable_unprepare(clk);
> +
> + return ret;
> }
>
> static const struct of_device_id v3_pci_of_match[] = {
> --
> 2.23.0
>
Powered by blists - more mailing lists