diff mbox series

PCI: visconti: Remove surplus dev_err() when using platform_get_irq_byname()

Message ID 20211001011626.132286-1-kw@linux.com (mailing list archive)
State New, archived
Headers show
Series PCI: visconti: Remove surplus dev_err() when using platform_get_irq_byname() | expand

Commit Message

Krzysztof Wilczyński Oct. 1, 2021, 1:16 a.m. UTC
There is no need to call the dev_err() function directly to print a
custom message when handling an error from either the platform_get_irq()
or platform_get_irq_byname() functions as both are going to display an
appropriate error message in case of a failure.

This change is as per suggestions from Coccinelle, e.g.,
  drivers/pci/controller/dwc/pcie-visconti.c:286:2-9: line 286 is redundant because platform_get_irq() already prints an error

Related:
  https://lore.kernel.org/all/20210310131913.2802385-1-kw@linux.com/
  https://lore.kernel.org/all/20200802142601.1635926-1-kw@linux.com/

Signed-off-by: Krzysztof Wilczyński <kw@linux.com>
---
 drivers/pci/controller/dwc/pcie-visconti.c | 4 +---
 1 file changed, 1 insertion(+), 3 deletions(-)

Comments

Nobuhiro Iwamatsu Oct. 1, 2021, 4:38 a.m. UTC | #1
Hi,

> -----Original Message-----
> From: Krzysztof Wilczyński [mailto:kw@linux.com]
> Sent: Friday, October 1, 2021 10:16 AM
> To: Bjorn Helgaas <bhelgaas@google.com>
> Cc: Lorenzo Pieralisi <lorenzo.pieralisi@arm.com>; iwamatsu nobuhiro(岩松 信洋 □SWC◯ACT)
> <nobuhiro1.iwamatsu@toshiba.co.jp>; linux-pci@vger.kernel.org; linux-arm-kernel@lists.infradead.org
> Subject: [PATCH] PCI: visconti: Remove surplus dev_err() when using platform_get_irq_byname()
> 
> There is no need to call the dev_err() function directly to print a
> custom message when handling an error from either the platform_get_irq()
> or platform_get_irq_byname() functions as both are going to display an
> appropriate error message in case of a failure.
> 
> This change is as per suggestions from Coccinelle, e.g.,
>   drivers/pci/controller/dwc/pcie-visconti.c:286:2-9: line 286 is redundant because platform_get_irq() already prints
> an error
> 
> Related:
>   https://lore.kernel.org/all/20210310131913.2802385-1-kw@linux.com/
>   https://lore.kernel.org/all/20200802142601.1635926-1-kw@linux.com/
> 
> Signed-off-by: Krzysztof Wilczyński <kw@linux.com>
> ---
>  drivers/pci/controller/dwc/pcie-visconti.c | 4 +---
>  1 file changed, 1 insertion(+), 3 deletions(-)

Thanks for your patch.

Acked-by: Nobuhiro Iwamatsu <nobuhiro1.iwamatsu@toshiba.co.jp>

> 
> diff --git a/drivers/pci/controller/dwc/pcie-visconti.c b/drivers/pci/controller/dwc/pcie-visconti.c
> index a88eab6829bb..076da46726a7 100644
> --- a/drivers/pci/controller/dwc/pcie-visconti.c
> +++ b/drivers/pci/controller/dwc/pcie-visconti.c
> @@ -282,10 +282,8 @@ static int visconti_add_pcie_port(struct visconti_pcie *pcie,
>  	struct device *dev = &pdev->dev;
> 
>  	pp->irq = platform_get_irq_byname(pdev, "intr");
> -	if (pp->irq < 0) {
> -		dev_err(dev, "Interrupt intr is missing");
> +	if (pp->irq < 0)
>  		return pp->irq;
> -	}
> 
>  	pp->ops = &visconti_pcie_host_ops;
> 
> --
> 2.33.0

Best regards,
  Nobuhiro
Lorenzo Pieralisi Oct. 5, 2021, 8:59 a.m. UTC | #2
On Fri, 1 Oct 2021 01:16:26 +0000, Krzysztof Wilczyński wrote:
> There is no need to call the dev_err() function directly to print a
> custom message when handling an error from either the platform_get_irq()
> or platform_get_irq_byname() functions as both are going to display an
> appropriate error message in case of a failure.
> 
> This change is as per suggestions from Coccinelle, e.g.,
>   drivers/pci/controller/dwc/pcie-visconti.c:286:2-9: line 286 is redundant because platform_get_irq() already prints an error
> 
> [...]

Applied to pci/dwc, thanks!

[1/1] PCI: visconti: Remove surplus dev_err() when using platform_get_irq_byname()
      https://git.kernel.org/lpieralisi/pci/c/99e8fc7d35

Thanks,
Lorenzo
diff mbox series

Patch

diff --git a/drivers/pci/controller/dwc/pcie-visconti.c b/drivers/pci/controller/dwc/pcie-visconti.c
index a88eab6829bb..076da46726a7 100644
--- a/drivers/pci/controller/dwc/pcie-visconti.c
+++ b/drivers/pci/controller/dwc/pcie-visconti.c
@@ -282,10 +282,8 @@  static int visconti_add_pcie_port(struct visconti_pcie *pcie,
 	struct device *dev = &pdev->dev;
 
 	pp->irq = platform_get_irq_byname(pdev, "intr");
-	if (pp->irq < 0) {
-		dev_err(dev, "Interrupt intr is missing");
+	if (pp->irq < 0)
 		return pp->irq;
-	}
 
 	pp->ops = &visconti_pcie_host_ops;