linux-kernel.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH] PCI: mediatek: fix error handling in mtk_pcie_parse_and_add_res()
@ 2017-06-05  6:27 Ryder Lee
  2017-06-15 21:11 ` Bjorn Helgaas
  0 siblings, 1 reply; 2+ messages in thread
From: Ryder Lee @ 2017-06-05  6:27 UTC (permalink / raw)
  To: Bjorn Helgaas
  Cc: linux-pci, linux-mediatek, linux-arm-kernel, linux-kernel, Ryder Lee

The 'linkup' variable would always increment by one whether the link
status is true or not. Therefore, this patch fixes the return value in
mtk_pcie_parse_and_add_res() and removes unnecessary 'linkup' variable.

Signed-off-by: Ryder Lee <ryder.lee@mediatek.com>
---
 drivers/pci/host/pcie-mediatek.c | 8 ++++----
 1 file changed, 4 insertions(+), 4 deletions(-)

diff --git a/drivers/pci/host/pcie-mediatek.c b/drivers/pci/host/pcie-mediatek.c
index 8ec8fa8..3baafa8 100644
--- a/drivers/pci/host/pcie-mediatek.c
+++ b/drivers/pci/host/pcie-mediatek.c
@@ -373,7 +373,7 @@ static int mtk_pcie_parse_and_add_res(struct mtk_pcie *pcie)
 	struct of_pci_range_parser parser;
 	struct of_pci_range range;
 	struct resource res;
-	int err, linkup = 0;
+	int err;
 
 	/* parse shared resources */
 	err = mtk_pcie_handle_shared_resource(pcie);
@@ -444,11 +444,11 @@ static int mtk_pcie_parse_and_add_res(struct mtk_pcie *pcie)
 
 		/* enable each port, and then check link status */
 		err = mtk_pcie_enable_ports(port);
-		if (!err)
-			linkup++;
+		if (err)
+			return err;
 	}
 
-	return !linkup;
+	return 0;
 }
 
 static int mtk_pcie_request_resources(struct mtk_pcie *pcie)
-- 
1.9.1

^ permalink raw reply related	[flat|nested] 2+ messages in thread

* Re: [PATCH] PCI: mediatek: fix error handling in mtk_pcie_parse_and_add_res()
  2017-06-05  6:27 [PATCH] PCI: mediatek: fix error handling in mtk_pcie_parse_and_add_res() Ryder Lee
@ 2017-06-15 21:11 ` Bjorn Helgaas
  0 siblings, 0 replies; 2+ messages in thread
From: Bjorn Helgaas @ 2017-06-15 21:11 UTC (permalink / raw)
  To: Ryder Lee
  Cc: Bjorn Helgaas, linux-pci, linux-mediatek, linux-kernel, linux-arm-kernel

On Mon, Jun 05, 2017 at 02:27:58PM +0800, Ryder Lee wrote:
> The 'linkup' variable would always increment by one whether the link
> status is true or not. Therefore, this patch fixes the return value in
> mtk_pcie_parse_and_add_res() and removes unnecessary 'linkup' variable.
> 
> Signed-off-by: Ryder Lee <ryder.lee@mediatek.com>

I folded this into pci/host-mediatek for v4.13, thanks!

I just noticed that we didn't get a MAINTAINERS update for this driver.
Can you send me that, too, please?

> ---
>  drivers/pci/host/pcie-mediatek.c | 8 ++++----
>  1 file changed, 4 insertions(+), 4 deletions(-)
> 
> diff --git a/drivers/pci/host/pcie-mediatek.c b/drivers/pci/host/pcie-mediatek.c
> index 8ec8fa8..3baafa8 100644
> --- a/drivers/pci/host/pcie-mediatek.c
> +++ b/drivers/pci/host/pcie-mediatek.c
> @@ -373,7 +373,7 @@ static int mtk_pcie_parse_and_add_res(struct mtk_pcie *pcie)
>  	struct of_pci_range_parser parser;
>  	struct of_pci_range range;
>  	struct resource res;
> -	int err, linkup = 0;
> +	int err;
>  
>  	/* parse shared resources */
>  	err = mtk_pcie_handle_shared_resource(pcie);
> @@ -444,11 +444,11 @@ static int mtk_pcie_parse_and_add_res(struct mtk_pcie *pcie)
>  
>  		/* enable each port, and then check link status */
>  		err = mtk_pcie_enable_ports(port);
> -		if (!err)
> -			linkup++;
> +		if (err)
> +			return err;
>  	}
>  
> -	return !linkup;
> +	return 0;
>  }
>  
>  static int mtk_pcie_request_resources(struct mtk_pcie *pcie)
> -- 
> 1.9.1
> 
> 
> _______________________________________________
> linux-arm-kernel mailing list
> linux-arm-kernel@lists.infradead.org
> http://lists.infradead.org/mailman/listinfo/linux-arm-kernel

^ permalink raw reply	[flat|nested] 2+ messages in thread

end of thread, other threads:[~2017-06-15 21:11 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2017-06-05  6:27 [PATCH] PCI: mediatek: fix error handling in mtk_pcie_parse_and_add_res() Ryder Lee
2017-06-15 21:11 ` Bjorn Helgaas

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).