diff mbox

[-next] PCI: faraday: Fix wrong pointer passed to PTR_ERR()

Message ID 1508242263-73684-1-git-send-email-weiyongjun1@huawei.com (mailing list archive)
State New, archived
Delegated to: Bjorn Helgaas
Headers show

Commit Message

Wei Yongjun Oct. 17, 2017, 12:11 p.m. UTC
PTR_ERR should access the value just tested by IS_ERR, otherwise
the wrong error code will be returned.

Fixes: 2eeb02b28579 ("PCI: faraday: Add clock handling")
Signed-off-by: Wei Yongjun <weiyongjun1@huawei.com>
---
 drivers/pci/host/pci-ftpci100.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

Comments

Linus Walleij Oct. 17, 2017, 4:22 p.m. UTC | #1
On Tue, Oct 17, 2017 at 2:11 PM, Wei Yongjun <weiyongjun1@huawei.com> wrote:

> PTR_ERR should access the value just tested by IS_ERR, otherwise
> the wrong error code will be returned.
>
> Fixes: 2eeb02b28579 ("PCI: faraday: Add clock handling")
> Signed-off-by: Wei Yongjun <weiyongjun1@huawei.com>

Whoops, thanks!
Reviewed-by: Linus Walleij <linus.walleij@linaro.org>

Yours,
Linus Walleij
Bjorn Helgaas Oct. 20, 2017, 11:03 p.m. UTC | #2
On Tue, Oct 17, 2017 at 12:11:03PM +0000, Wei Yongjun wrote:
> PTR_ERR should access the value just tested by IS_ERR, otherwise
> the wrong error code will be returned.
> 
> Fixes: 2eeb02b28579 ("PCI: faraday: Add clock handling")
> Signed-off-by: Wei Yongjun <weiyongjun1@huawei.com>

Applied with Linus' reviewed-by to pci/host-faraday for v4.15, thanks!

> ---
>  drivers/pci/host/pci-ftpci100.c | 2 +-
>  1 file changed, 1 insertion(+), 1 deletion(-)
> 
> diff --git a/drivers/pci/host/pci-ftpci100.c b/drivers/pci/host/pci-ftpci100.c
> index 06d9687..fae6bd1 100644
> --- a/drivers/pci/host/pci-ftpci100.c
> +++ b/drivers/pci/host/pci-ftpci100.c
> @@ -463,7 +463,7 @@ static int faraday_pci_probe(struct platform_device *pdev)
>  	}
>  	p->bus_clk = devm_clk_get(dev, "PCICLK");
>  	if (IS_ERR(p->bus_clk))
> -		return PTR_ERR(clk);
> +		return PTR_ERR(p->bus_clk);
>  	ret = clk_prepare_enable(p->bus_clk);
>  	if (ret) {
>  		dev_err(dev, "could not prepare PCICLK\n");
>
diff mbox

Patch

diff --git a/drivers/pci/host/pci-ftpci100.c b/drivers/pci/host/pci-ftpci100.c
index 06d9687..fae6bd1 100644
--- a/drivers/pci/host/pci-ftpci100.c
+++ b/drivers/pci/host/pci-ftpci100.c
@@ -463,7 +463,7 @@  static int faraday_pci_probe(struct platform_device *pdev)
 	}
 	p->bus_clk = devm_clk_get(dev, "PCICLK");
 	if (IS_ERR(p->bus_clk))
-		return PTR_ERR(clk);
+		return PTR_ERR(p->bus_clk);
 	ret = clk_prepare_enable(p->bus_clk);
 	if (ret) {
 		dev_err(dev, "could not prepare PCICLK\n");