All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH] PCI: rcar: Use common error handling code in rcar_pcie_enable_msi()
@ 2017-10-30  7:35 ` SF Markus Elfring
  0 siblings, 0 replies; 12+ messages in thread
From: SF Markus Elfring @ 2017-10-30  7:35 UTC (permalink / raw)
  To: linux-pci, linux-renesas-soc, Bjorn Helgaas, Laurent Pinchart,
	Simon Horman
  Cc: LKML, kernel-janitors

From: Markus Elfring <elfring@users.sourceforge.net>
Date: Mon, 30 Oct 2017 08:28:06 +0100

Adjust a jump target so that a specific error message is stored only once
at the end of this function implementation.
Replace two calls of the function "dev_err" by goto statements.

This issue was detected by using the Coccinelle software.

Signed-off-by: Markus Elfring <elfring@users.sourceforge.net>
---
 drivers/pci/host/pcie-rcar.c | 15 ++++++---------
 1 file changed, 6 insertions(+), 9 deletions(-)

diff --git a/drivers/pci/host/pcie-rcar.c b/drivers/pci/host/pcie-rcar.c
index 12796eccb2be..38101f8bebf1 100644
--- a/drivers/pci/host/pcie-rcar.c
+++ b/drivers/pci/host/pcie-rcar.c
@@ -873,18 +873,14 @@ static int rcar_pcie_enable_msi(struct rcar_pcie *pcie)
 	err = devm_request_irq(dev, msi->irq1, rcar_pcie_msi_irq,
 			       IRQF_SHARED | IRQF_NO_THREAD,
 			       rcar_msi_irq_chip.name, pcie);
-	if (err < 0) {
-		dev_err(dev, "failed to request IRQ: %d\n", err);
-		goto err;
-	}
+	if (err < 0)
+		goto report_request_failure;
 
 	err = devm_request_irq(dev, msi->irq2, rcar_pcie_msi_irq,
 			       IRQF_SHARED | IRQF_NO_THREAD,
 			       rcar_msi_irq_chip.name, pcie);
-	if (err < 0) {
-		dev_err(dev, "failed to request IRQ: %d\n", err);
-		goto err;
-	}
+	if (err < 0)
+		goto report_request_failure;
 
 	/* setup MSI data target */
 	msi->pages = __get_free_pages(GFP_KERNEL, 0);
@@ -898,7 +894,8 @@ static int rcar_pcie_enable_msi(struct rcar_pcie *pcie)
 
 	return 0;
 
-err:
+report_request_failure:
+	dev_err(dev, "failed to request IRQ: %d\n", err);
 	irq_domain_remove(msi->domain);
 	return err;
 }
-- 
2.14.3

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

* [PATCH] PCI: rcar: Use common error handling code in rcar_pcie_enable_msi()
@ 2017-10-30  7:35 ` SF Markus Elfring
  0 siblings, 0 replies; 12+ messages in thread
From: SF Markus Elfring @ 2017-10-30  7:35 UTC (permalink / raw)
  To: linux-pci, linux-renesas-soc, Bjorn Helgaas, Laurent Pinchart,
	Simon Horman
  Cc: LKML, kernel-janitors

From: Markus Elfring <elfring@users.sourceforge.net>
Date: Mon, 30 Oct 2017 08:28:06 +0100

Adjust a jump target so that a specific error message is stored only once
at the end of this function implementation.
Replace two calls of the function "dev_err" by goto statements.

This issue was detected by using the Coccinelle software.

Signed-off-by: Markus Elfring <elfring@users.sourceforge.net>
---
 drivers/pci/host/pcie-rcar.c | 15 ++++++---------
 1 file changed, 6 insertions(+), 9 deletions(-)

diff --git a/drivers/pci/host/pcie-rcar.c b/drivers/pci/host/pcie-rcar.c
index 12796eccb2be..38101f8bebf1 100644
--- a/drivers/pci/host/pcie-rcar.c
+++ b/drivers/pci/host/pcie-rcar.c
@@ -873,18 +873,14 @@ static int rcar_pcie_enable_msi(struct rcar_pcie *pcie)
 	err = devm_request_irq(dev, msi->irq1, rcar_pcie_msi_irq,
 			       IRQF_SHARED | IRQF_NO_THREAD,
 			       rcar_msi_irq_chip.name, pcie);
-	if (err < 0) {
-		dev_err(dev, "failed to request IRQ: %d\n", err);
-		goto err;
-	}
+	if (err < 0)
+		goto report_request_failure;
 
 	err = devm_request_irq(dev, msi->irq2, rcar_pcie_msi_irq,
 			       IRQF_SHARED | IRQF_NO_THREAD,
 			       rcar_msi_irq_chip.name, pcie);
-	if (err < 0) {
-		dev_err(dev, "failed to request IRQ: %d\n", err);
-		goto err;
-	}
+	if (err < 0)
+		goto report_request_failure;
 
 	/* setup MSI data target */
 	msi->pages = __get_free_pages(GFP_KERNEL, 0);
@@ -898,7 +894,8 @@ static int rcar_pcie_enable_msi(struct rcar_pcie *pcie)
 
 	return 0;
 
-err:
+report_request_failure:
+	dev_err(dev, "failed to request IRQ: %d\n", err);
 	irq_domain_remove(msi->domain);
 	return err;
 }
-- 
2.14.3


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

* Re: [PATCH] PCI: rcar: Use common error handling code in rcar_pcie_enable_msi()
  2017-10-30  7:35 ` SF Markus Elfring
@ 2017-11-01  8:18   ` Simon Horman
  -1 siblings, 0 replies; 12+ messages in thread
From: Simon Horman @ 2017-11-01  8:18 UTC (permalink / raw)
  To: SF Markus Elfring
  Cc: linux-pci, linux-renesas-soc, Bjorn Helgaas, Laurent Pinchart,
	LKML, kernel-janitors

On Mon, Oct 30, 2017 at 08:35:30AM +0100, SF Markus Elfring wrote:
> From: Markus Elfring <elfring@users.sourceforge.net>
> Date: Mon, 30 Oct 2017 08:28:06 +0100
> 
> Adjust a jump target so that a specific error message is stored only once
> at the end of this function implementation.
> Replace two calls of the function "dev_err" by goto statements.
> 
> This issue was detected by using the Coccinelle software.
> 
> Signed-off-by: Markus Elfring <elfring@users.sourceforge.net>

This is fine by me except that the change in the name of the goto label
seems spurious. If think it should be left as-is. But if you really want to
change it then as it is an error path I should suggest it describe that its
an error and what unwinding is done, f.e.  err_remove_domain.

> ---
>  drivers/pci/host/pcie-rcar.c | 15 ++++++---------
>  1 file changed, 6 insertions(+), 9 deletions(-)
> 
> diff --git a/drivers/pci/host/pcie-rcar.c b/drivers/pci/host/pcie-rcar.c
> index 12796eccb2be..38101f8bebf1 100644
> --- a/drivers/pci/host/pcie-rcar.c
> +++ b/drivers/pci/host/pcie-rcar.c
> @@ -873,18 +873,14 @@ static int rcar_pcie_enable_msi(struct rcar_pcie *pcie)
>  	err = devm_request_irq(dev, msi->irq1, rcar_pcie_msi_irq,
>  			       IRQF_SHARED | IRQF_NO_THREAD,
>  			       rcar_msi_irq_chip.name, pcie);
> -	if (err < 0) {
> -		dev_err(dev, "failed to request IRQ: %d\n", err);
> -		goto err;
> -	}
> +	if (err < 0)
> +		goto report_request_failure;
>  
>  	err = devm_request_irq(dev, msi->irq2, rcar_pcie_msi_irq,
>  			       IRQF_SHARED | IRQF_NO_THREAD,
>  			       rcar_msi_irq_chip.name, pcie);
> -	if (err < 0) {
> -		dev_err(dev, "failed to request IRQ: %d\n", err);
> -		goto err;
> -	}
> +	if (err < 0)
> +		goto report_request_failure;
>  
>  	/* setup MSI data target */
>  	msi->pages = __get_free_pages(GFP_KERNEL, 0);
> @@ -898,7 +894,8 @@ static int rcar_pcie_enable_msi(struct rcar_pcie *pcie)
>  
>  	return 0;
>  
> -err:
> +report_request_failure:
> +	dev_err(dev, "failed to request IRQ: %d\n", err);
>  	irq_domain_remove(msi->domain);
>  	return err;
>  }
> -- 
> 2.14.3
> 

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

* Re: [PATCH] PCI: rcar: Use common error handling code in rcar_pcie_enable_msi()
@ 2017-11-01  8:18   ` Simon Horman
  0 siblings, 0 replies; 12+ messages in thread
From: Simon Horman @ 2017-11-01  8:18 UTC (permalink / raw)
  To: SF Markus Elfring
  Cc: linux-pci, linux-renesas-soc, Bjorn Helgaas, Laurent Pinchart,
	LKML, kernel-janitors

On Mon, Oct 30, 2017 at 08:35:30AM +0100, SF Markus Elfring wrote:
> From: Markus Elfring <elfring@users.sourceforge.net>
> Date: Mon, 30 Oct 2017 08:28:06 +0100
> 
> Adjust a jump target so that a specific error message is stored only once
> at the end of this function implementation.
> Replace two calls of the function "dev_err" by goto statements.
> 
> This issue was detected by using the Coccinelle software.
> 
> Signed-off-by: Markus Elfring <elfring@users.sourceforge.net>

This is fine by me except that the change in the name of the goto label
seems spurious. If think it should be left as-is. But if you really want to
change it then as it is an error path I should suggest it describe that its
an error and what unwinding is done, f.e.  err_remove_domain.

> ---
>  drivers/pci/host/pcie-rcar.c | 15 ++++++---------
>  1 file changed, 6 insertions(+), 9 deletions(-)
> 
> diff --git a/drivers/pci/host/pcie-rcar.c b/drivers/pci/host/pcie-rcar.c
> index 12796eccb2be..38101f8bebf1 100644
> --- a/drivers/pci/host/pcie-rcar.c
> +++ b/drivers/pci/host/pcie-rcar.c
> @@ -873,18 +873,14 @@ static int rcar_pcie_enable_msi(struct rcar_pcie *pcie)
>  	err = devm_request_irq(dev, msi->irq1, rcar_pcie_msi_irq,
>  			       IRQF_SHARED | IRQF_NO_THREAD,
>  			       rcar_msi_irq_chip.name, pcie);
> -	if (err < 0) {
> -		dev_err(dev, "failed to request IRQ: %d\n", err);
> -		goto err;
> -	}
> +	if (err < 0)
> +		goto report_request_failure;
>  
>  	err = devm_request_irq(dev, msi->irq2, rcar_pcie_msi_irq,
>  			       IRQF_SHARED | IRQF_NO_THREAD,
>  			       rcar_msi_irq_chip.name, pcie);
> -	if (err < 0) {
> -		dev_err(dev, "failed to request IRQ: %d\n", err);
> -		goto err;
> -	}
> +	if (err < 0)
> +		goto report_request_failure;
>  
>  	/* setup MSI data target */
>  	msi->pages = __get_free_pages(GFP_KERNEL, 0);
> @@ -898,7 +894,8 @@ static int rcar_pcie_enable_msi(struct rcar_pcie *pcie)
>  
>  	return 0;
>  
> -err:
> +report_request_failure:
> +	dev_err(dev, "failed to request IRQ: %d\n", err);
>  	irq_domain_remove(msi->domain);
>  	return err;
>  }
> -- 
> 2.14.3
> 

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

* Re: PCI: rcar: Use common error handling code in rcar_pcie_enable_msi()
  2017-11-01  8:18   ` Simon Horman
@ 2017-11-01  8:57     ` SF Markus Elfring
  -1 siblings, 0 replies; 12+ messages in thread
From: SF Markus Elfring @ 2017-11-01  8:57 UTC (permalink / raw)
  To: Simon Horman, linux-pci, linux-renesas-soc
  Cc: Bjorn Helgaas, Laurent Pinchart, LKML, kernel-janitors

> This is fine by me

Thanks for another bit of change acceptance.


> except that the change in the name of the goto label seems spurious.

I am curious if the popularity of a jump label like “err” will decrease
(in the Linux source files) over time.


> But if you really want to change it then as it is an error path
> I should suggest it describe that its an error and what unwinding
> is done, f.e.  err_remove_domain.

* Do you get such a kind of information only when the prefix “err_”
  is added to this identifier?

* Do you prefer to stress the “domain removal”
  (or the shown error message) in the label?

Regards,
Markus

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

* Re: PCI: rcar: Use common error handling code in rcar_pcie_enable_msi()
@ 2017-11-01  8:57     ` SF Markus Elfring
  0 siblings, 0 replies; 12+ messages in thread
From: SF Markus Elfring @ 2017-11-01  8:57 UTC (permalink / raw)
  To: Simon Horman, linux-pci, linux-renesas-soc
  Cc: Bjorn Helgaas, Laurent Pinchart, LKML, kernel-janitors

> This is fine by me

Thanks for another bit of change acceptance.


> except that the change in the name of the goto label seems spurious.

I am curious if the popularity of a jump label like “err” will decrease
(in the Linux source files) over time.


> But if you really want to change it then as it is an error path
> I should suggest it describe that its an error and what unwinding
> is done, f.e.  err_remove_domain.

* Do you get such a kind of information only when the prefix “err_”
  is added to this identifier?

* Do you prefer to stress the “domain removal”
  (or the shown error message) in the label?

Regards,
Markus

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

* Re: PCI: rcar: Use common error handling code in rcar_pcie_enable_msi()
  2017-11-01  8:57     ` SF Markus Elfring
@ 2017-11-02  8:12       ` Simon Horman
  -1 siblings, 0 replies; 12+ messages in thread
From: Simon Horman @ 2017-11-02  8:12 UTC (permalink / raw)
  To: SF Markus Elfring
  Cc: linux-pci, linux-renesas-soc, Bjorn Helgaas, Laurent Pinchart,
	LKML, kernel-janitors

On Wed, Nov 01, 2017 at 09:57:00AM +0100, SF Markus Elfring wrote:
> > This is fine by me
> 
> Thanks for another bit of change acceptance.
> 
> 
> > except that the change in the name of the goto label seems spurious.
> 
> I am curious if the popularity of a jump label like “err” will decrease
> (in the Linux source files) over time.

If your current patch bombing is successful then it will, at least in the
short term. But my comments relate to the current best practice,
not the one you seem to be trying to introduce.

> > But if you really want to change it then as it is an error path
> > I should suggest it describe that its an error and what unwinding
> > is done, f.e.  err_remove_domain.
> 
> * Do you get such a kind of information only when the prefix “err_”
>   is added to this identifier?

Yes, err indicates its an error path.

> 
> * Do you prefer to stress the “domain removal”
>   (or the shown error message) in the label?

I prefer to stress the unwind path as that is the most important
aspect of the error path.


I have no interest in a prelonged debate about the naming of labels.
As I pointed out its a spurious aspect of your change. If you wish me to
Ack your change then please either drop that change or update it - as I
already suggested. Else lets discontinue this sub-thread.

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

* Re: PCI: rcar: Use common error handling code in rcar_pcie_enable_msi()
@ 2017-11-02  8:12       ` Simon Horman
  0 siblings, 0 replies; 12+ messages in thread
From: Simon Horman @ 2017-11-02  8:12 UTC (permalink / raw)
  To: SF Markus Elfring
  Cc: linux-pci, linux-renesas-soc, Bjorn Helgaas, Laurent Pinchart,
	LKML, kernel-janitors

On Wed, Nov 01, 2017 at 09:57:00AM +0100, SF Markus Elfring wrote:
> > This is fine by me
> 
> Thanks for another bit of change acceptance.
> 
> 
> > except that the change in the name of the goto label seems spurious.
> 
> I am curious if the popularity of a jump label like “err” will decrease
> (in the Linux source files) over time.

If your current patch bombing is successful then it will, at least in the
short term. But my comments relate to the current best practice,
not the one you seem to be trying to introduce.

> > But if you really want to change it then as it is an error path
> > I should suggest it describe that its an error and what unwinding
> > is done, f.e.  err_remove_domain.
> 
> * Do you get such a kind of information only when the prefix “err_”
>   is added to this identifier?

Yes, err indicates its an error path.

> 
> * Do you prefer to stress the “domain removal”
>   (or the shown error message) in the label?

I prefer to stress the unwind path as that is the most important
aspect of the error path.


I have no interest in a prelonged debate about the naming of labels.
As I pointed out its a spurious aspect of your change. If you wish me to
Ack your change then please either drop that change or update it - as I
already suggested. Else lets discontinue this sub-thread.

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

* [PATCH v2] PCI: rcar: Use common error handling code in rcar_pcie_enable_msi()
  2017-11-02  8:12       ` Simon Horman
@ 2017-11-02 13:00         ` SF Markus Elfring
  -1 siblings, 0 replies; 12+ messages in thread
From: SF Markus Elfring @ 2017-11-02 13:00 UTC (permalink / raw)
  To: linux-pci, linux-renesas-soc, Bjorn Helgaas, Laurent Pinchart,
	Simon Horman
  Cc: LKML, kernel-janitors

From: Markus Elfring <elfring@users.sourceforge.net>
Date: Thu, 2 Nov 2017 13:35:17 +0100

* Adjust a jump target so that a specific error message is stored only once
  at the end of this function implementation.

* Replace two calls of the function "dev_err" by goto statements.

This issue was detected by using the Coccinelle software.

Link: https://lkml.org/lkml/2017/11/2/140
Link: https://lkml.kernel.org/r/<20171102081239.bzaunax3uotejqja@verge.net.au>
Signed-off-by: Markus Elfring <elfring@users.sourceforge.net>
---

v2:
An other jump label was requested by Simon Horman.

 drivers/pci/host/pcie-rcar.c | 15 ++++++---------
 1 file changed, 6 insertions(+), 9 deletions(-)

diff --git a/drivers/pci/host/pcie-rcar.c b/drivers/pci/host/pcie-rcar.c
index 12796eccb2be..f3c1ffdf8072 100644
--- a/drivers/pci/host/pcie-rcar.c
+++ b/drivers/pci/host/pcie-rcar.c
@@ -873,18 +873,14 @@ static int rcar_pcie_enable_msi(struct rcar_pcie *pcie)
 	err = devm_request_irq(dev, msi->irq1, rcar_pcie_msi_irq,
 			       IRQF_SHARED | IRQF_NO_THREAD,
 			       rcar_msi_irq_chip.name, pcie);
-	if (err < 0) {
-		dev_err(dev, "failed to request IRQ: %d\n", err);
-		goto err;
-	}
+	if (err < 0)
+		goto err_remove_domain;
 
 	err = devm_request_irq(dev, msi->irq2, rcar_pcie_msi_irq,
 			       IRQF_SHARED | IRQF_NO_THREAD,
 			       rcar_msi_irq_chip.name, pcie);
-	if (err < 0) {
-		dev_err(dev, "failed to request IRQ: %d\n", err);
-		goto err;
-	}
+	if (err < 0)
+		goto err_remove_domain;
 
 	/* setup MSI data target */
 	msi->pages = __get_free_pages(GFP_KERNEL, 0);
@@ -898,7 +894,8 @@ static int rcar_pcie_enable_msi(struct rcar_pcie *pcie)
 
 	return 0;
 
-err:
+err_remove_domain:
+	dev_err(dev, "failed to request IRQ: %d\n", err);
 	irq_domain_remove(msi->domain);
 	return err;
 }
-- 
2.15.0

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

* [PATCH v2] PCI: rcar: Use common error handling code in rcar_pcie_enable_msi()
@ 2017-11-02 13:00         ` SF Markus Elfring
  0 siblings, 0 replies; 12+ messages in thread
From: SF Markus Elfring @ 2017-11-02 13:00 UTC (permalink / raw)
  To: linux-pci, linux-renesas-soc, Bjorn Helgaas, Laurent Pinchart,
	Simon Horman
  Cc: LKML, kernel-janitors

From: Markus Elfring <elfring@users.sourceforge.net>
Date: Thu, 2 Nov 2017 13:35:17 +0100

* Adjust a jump target so that a specific error message is stored only once
  at the end of this function implementation.

* Replace two calls of the function "dev_err" by goto statements.

This issue was detected by using the Coccinelle software.

Link: https://lkml.org/lkml/2017/11/2/140
Link: https://lkml.kernel.org/r/<20171102081239.bzaunax3uotejqja@verge.net.au>
Signed-off-by: Markus Elfring <elfring@users.sourceforge.net>
---

v2:
An other jump label was requested by Simon Horman.

 drivers/pci/host/pcie-rcar.c | 15 ++++++---------
 1 file changed, 6 insertions(+), 9 deletions(-)

diff --git a/drivers/pci/host/pcie-rcar.c b/drivers/pci/host/pcie-rcar.c
index 12796eccb2be..f3c1ffdf8072 100644
--- a/drivers/pci/host/pcie-rcar.c
+++ b/drivers/pci/host/pcie-rcar.c
@@ -873,18 +873,14 @@ static int rcar_pcie_enable_msi(struct rcar_pcie *pcie)
 	err = devm_request_irq(dev, msi->irq1, rcar_pcie_msi_irq,
 			       IRQF_SHARED | IRQF_NO_THREAD,
 			       rcar_msi_irq_chip.name, pcie);
-	if (err < 0) {
-		dev_err(dev, "failed to request IRQ: %d\n", err);
-		goto err;
-	}
+	if (err < 0)
+		goto err_remove_domain;
 
 	err = devm_request_irq(dev, msi->irq2, rcar_pcie_msi_irq,
 			       IRQF_SHARED | IRQF_NO_THREAD,
 			       rcar_msi_irq_chip.name, pcie);
-	if (err < 0) {
-		dev_err(dev, "failed to request IRQ: %d\n", err);
-		goto err;
-	}
+	if (err < 0)
+		goto err_remove_domain;
 
 	/* setup MSI data target */
 	msi->pages = __get_free_pages(GFP_KERNEL, 0);
@@ -898,7 +894,8 @@ static int rcar_pcie_enable_msi(struct rcar_pcie *pcie)
 
 	return 0;
 
-err:
+err_remove_domain:
+	dev_err(dev, "failed to request IRQ: %d\n", err);
 	irq_domain_remove(msi->domain);
 	return err;
 }
-- 
2.15.0


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

* Re: [PATCH v2] PCI: rcar: Use common error handling code in rcar_pcie_enable_msi()
  2017-11-02 13:00         ` SF Markus Elfring
@ 2017-11-02 19:25           ` Geert Uytterhoeven
  -1 siblings, 0 replies; 12+ messages in thread
From: Geert Uytterhoeven @ 2017-11-02 19:25 UTC (permalink / raw)
  To: SF Markus Elfring
  Cc: linux-pci, Linux-Renesas, Bjorn Helgaas, Laurent Pinchart,
	Simon Horman, LKML, kernel-janitors

On Thu, Nov 2, 2017 at 2:00 PM, SF Markus Elfring
<elfring@users.sourceforge.net> wrote:
> From: Markus Elfring <elfring@users.sourceforge.net>
> Date: Thu, 2 Nov 2017 13:35:17 +0100
>
> * Adjust a jump target so that a specific error message is stored only once
>   at the end of this function implementation.
>
> * Replace two calls of the function "dev_err" by goto statements.
>
> This issue was detected by using the Coccinelle software.
>
> Link: https://lkml.org/lkml/2017/11/2/140
> Link: https://lkml.kernel.org/r/<20171102081239.bzaunax3uotejqja@verge.net.au>
> Signed-off-by: Markus Elfring <elfring@users.sourceforge.net>
> ---
>
> v2:
> An other jump label was requested by Simon Horman.
>
>  drivers/pci/host/pcie-rcar.c | 15 ++++++---------
>  1 file changed, 6 insertions(+), 9 deletions(-)
>
> diff --git a/drivers/pci/host/pcie-rcar.c b/drivers/pci/host/pcie-rcar.c
> index 12796eccb2be..f3c1ffdf8072 100644
> --- a/drivers/pci/host/pcie-rcar.c
> +++ b/drivers/pci/host/pcie-rcar.c
> @@ -873,18 +873,14 @@ static int rcar_pcie_enable_msi(struct rcar_pcie *pcie)
>         err = devm_request_irq(dev, msi->irq1, rcar_pcie_msi_irq,
>                                IRQF_SHARED | IRQF_NO_THREAD,
>                                rcar_msi_irq_chip.name, pcie);
> -       if (err < 0) {
> -               dev_err(dev, "failed to request IRQ: %d\n", err);
> -               goto err;
> -       }
> +       if (err < 0)
> +               goto err_remove_domain;
>
>         err = devm_request_irq(dev, msi->irq2, rcar_pcie_msi_irq,
>                                IRQF_SHARED | IRQF_NO_THREAD,
>                                rcar_msi_irq_chip.name, pcie);
> -       if (err < 0) {
> -               dev_err(dev, "failed to request IRQ: %d\n", err);
> -               goto err;
> -       }
> +       if (err < 0)
> +               goto err_remove_domain;
>
>         /* setup MSI data target */
>         msi->pages = __get_free_pages(GFP_KERNEL, 0);
> @@ -898,7 +894,8 @@ static int rcar_pcie_enable_msi(struct rcar_pcie *pcie)
>
>         return 0;
>
> -err:
> +err_remove_domain:
> +       dev_err(dev, "failed to request IRQ: %d\n", err);

Moving the error message is confusing and counter-productive:
if you need to add another error case + goto err_remove_domain
later, you'll have to move it back to all the older cases.

Hence
NAKed-by: Geert Uytterhoeven <geert@linux-m68k.org>

>         irq_domain_remove(msi->domain);
>         return err;
>  }

Gr{oetje,eeting}s,

                        Geert

--
Geert Uytterhoeven -- There's lots of Linux beyond ia32 -- geert@linux-m68k.org

In personal conversations with technical people, I call myself a hacker. But
when I'm talking to journalists I just say "programmer" or something like that.
                                -- Linus Torvalds

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

* Re: [PATCH v2] PCI: rcar: Use common error handling code in rcar_pcie_enable_msi()
@ 2017-11-02 19:25           ` Geert Uytterhoeven
  0 siblings, 0 replies; 12+ messages in thread
From: Geert Uytterhoeven @ 2017-11-02 19:25 UTC (permalink / raw)
  To: SF Markus Elfring
  Cc: linux-pci, Linux-Renesas, Bjorn Helgaas, Laurent Pinchart,
	Simon Horman, LKML, kernel-janitors

On Thu, Nov 2, 2017 at 2:00 PM, SF Markus Elfring
<elfring@users.sourceforge.net> wrote:
> From: Markus Elfring <elfring@users.sourceforge.net>
> Date: Thu, 2 Nov 2017 13:35:17 +0100
>
> * Adjust a jump target so that a specific error message is stored only once
>   at the end of this function implementation.
>
> * Replace two calls of the function "dev_err" by goto statements.
>
> This issue was detected by using the Coccinelle software.
>
> Link: https://lkml.org/lkml/2017/11/2/140
> Link: https://lkml.kernel.org/r/<20171102081239.bzaunax3uotejqja@verge.net.au>
> Signed-off-by: Markus Elfring <elfring@users.sourceforge.net>
> ---
>
> v2:
> An other jump label was requested by Simon Horman.
>
>  drivers/pci/host/pcie-rcar.c | 15 ++++++---------
>  1 file changed, 6 insertions(+), 9 deletions(-)
>
> diff --git a/drivers/pci/host/pcie-rcar.c b/drivers/pci/host/pcie-rcar.c
> index 12796eccb2be..f3c1ffdf8072 100644
> --- a/drivers/pci/host/pcie-rcar.c
> +++ b/drivers/pci/host/pcie-rcar.c
> @@ -873,18 +873,14 @@ static int rcar_pcie_enable_msi(struct rcar_pcie *pcie)
>         err = devm_request_irq(dev, msi->irq1, rcar_pcie_msi_irq,
>                                IRQF_SHARED | IRQF_NO_THREAD,
>                                rcar_msi_irq_chip.name, pcie);
> -       if (err < 0) {
> -               dev_err(dev, "failed to request IRQ: %d\n", err);
> -               goto err;
> -       }
> +       if (err < 0)
> +               goto err_remove_domain;
>
>         err = devm_request_irq(dev, msi->irq2, rcar_pcie_msi_irq,
>                                IRQF_SHARED | IRQF_NO_THREAD,
>                                rcar_msi_irq_chip.name, pcie);
> -       if (err < 0) {
> -               dev_err(dev, "failed to request IRQ: %d\n", err);
> -               goto err;
> -       }
> +       if (err < 0)
> +               goto err_remove_domain;
>
>         /* setup MSI data target */
>         msi->pages = __get_free_pages(GFP_KERNEL, 0);
> @@ -898,7 +894,8 @@ static int rcar_pcie_enable_msi(struct rcar_pcie *pcie)
>
>         return 0;
>
> -err:
> +err_remove_domain:
> +       dev_err(dev, "failed to request IRQ: %d\n", err);

Moving the error message is confusing and counter-productive:
if you need to add another error case + goto err_remove_domain
later, you'll have to move it back to all the older cases.

Hence
NAKed-by: Geert Uytterhoeven <geert@linux-m68k.org>

>         irq_domain_remove(msi->domain);
>         return err;
>  }

Gr{oetje,eeting}s,

                        Geert

--
Geert Uytterhoeven -- There's lots of Linux beyond ia32 -- geert@linux-m68k.org

In personal conversations with technical people, I call myself a hacker. But
when I'm talking to journalists I just say "programmer" or something like that.
                                -- Linus Torvalds

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

end of thread, other threads:[~2017-11-02 19:25 UTC | newest]

Thread overview: 12+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2017-10-30  7:35 [PATCH] PCI: rcar: Use common error handling code in rcar_pcie_enable_msi() SF Markus Elfring
2017-10-30  7:35 ` SF Markus Elfring
2017-11-01  8:18 ` Simon Horman
2017-11-01  8:18   ` Simon Horman
2017-11-01  8:57   ` SF Markus Elfring
2017-11-01  8:57     ` SF Markus Elfring
2017-11-02  8:12     ` Simon Horman
2017-11-02  8:12       ` Simon Horman
2017-11-02 13:00       ` [PATCH v2] " SF Markus Elfring
2017-11-02 13:00         ` SF Markus Elfring
2017-11-02 19:25         ` Geert Uytterhoeven
2017-11-02 19:25           ` Geert Uytterhoeven

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.