[PATCH] PCI: dw-rockchip: Remove redundant dev_err()

Chen Ni posted 1 patch 2 months, 1 week ago
drivers/pci/controller/dwc/pcie-dw-rockchip.c | 4 +---
1 file changed, 1 insertion(+), 3 deletions(-)
[PATCH] PCI: dw-rockchip: Remove redundant dev_err()
Posted by Chen Ni 2 months, 1 week ago
There is no need to call the dev_err() function directly to print a
custom message when handling an error from platform_get_irq_byname()
function as it is going to display an appropriate error message in case
of a failure.

Signed-off-by: Chen Ni <nichen@iscas.ac.cn>
---
 drivers/pci/controller/dwc/pcie-dw-rockchip.c | 4 +---
 1 file changed, 1 insertion(+), 3 deletions(-)

diff --git a/drivers/pci/controller/dwc/pcie-dw-rockchip.c b/drivers/pci/controller/dwc/pcie-dw-rockchip.c
index 1170e1107508..3770e566b597 100644
--- a/drivers/pci/controller/dwc/pcie-dw-rockchip.c
+++ b/drivers/pci/controller/dwc/pcie-dw-rockchip.c
@@ -450,10 +450,8 @@ static int rockchip_pcie_configure_ep(struct platform_device *pdev,
 		return -ENODEV;
 
 	irq = platform_get_irq_byname(pdev, "sys");
-	if (irq < 0) {
-		dev_err(dev, "missing sys IRQ resource\n");
+	if (irq < 0)
 		return irq;
-	}
 
 	ret = devm_request_threaded_irq(dev, irq, NULL,
 					rockchip_pcie_ep_sys_irq_thread,
-- 
2.25.1
Re: [PATCH] PCI: dw-rockchip: Remove redundant dev_err()
Posted by Markus Elfring 1 month, 3 weeks ago
> There is no need to call the dev_err() function directly to print a
> custom message when handling an error from platform_get_irq_byname()
> function as it is going to display an appropriate error message in case

           call?


> of a failure.


Were any static source code analysis tools involved in the detection
of the presented change possibility?


By the way:
Such a patch can be generated also by the means of the semantic patch
language (Coccinelle software) for example.

Regards,
Markus
Re: [PATCH] PCI: dw-rockchip: Remove redundant dev_err()
Posted by Manivannan Sadhasivam 2 months ago
On Wed, Sep 18, 2024 at 03:44:01PM +0800, Chen Ni wrote:
> There is no need to call the dev_err() function directly to print a
> custom message when handling an error from platform_get_irq_byname()
> function as it is going to display an appropriate error message in case
> of a failure.
> 
> Signed-off-by: Chen Ni <nichen@iscas.ac.cn>

Reviewed-by: Manivannan Sadhasivam <manivannan.sadhasivam@linaro.org>

- Mani

> ---
>  drivers/pci/controller/dwc/pcie-dw-rockchip.c | 4 +---
>  1 file changed, 1 insertion(+), 3 deletions(-)
> 
> diff --git a/drivers/pci/controller/dwc/pcie-dw-rockchip.c b/drivers/pci/controller/dwc/pcie-dw-rockchip.c
> index 1170e1107508..3770e566b597 100644
> --- a/drivers/pci/controller/dwc/pcie-dw-rockchip.c
> +++ b/drivers/pci/controller/dwc/pcie-dw-rockchip.c
> @@ -450,10 +450,8 @@ static int rockchip_pcie_configure_ep(struct platform_device *pdev,
>  		return -ENODEV;
>  
>  	irq = platform_get_irq_byname(pdev, "sys");
> -	if (irq < 0) {
> -		dev_err(dev, "missing sys IRQ resource\n");
> +	if (irq < 0)
>  		return irq;
> -	}
>  
>  	ret = devm_request_threaded_irq(dev, irq, NULL,
>  					rockchip_pcie_ep_sys_irq_thread,
> -- 
> 2.25.1
> 

-- 
மணிவண்ணன் சதாசிவம்
Re: [PATCH] PCI: dw-rockchip: Remove redundant dev_err()
Posted by Heiko Stuebner 2 months, 1 week ago
Am Mittwoch, 18. September 2024, 09:44:01 CEST schrieb Chen Ni:
> There is no need to call the dev_err() function directly to print a
> custom message when handling an error from platform_get_irq_byname()
> function as it is going to display an appropriate error message in case
> of a failure.
> 
> Signed-off-by: Chen Ni <nichen@iscas.ac.cn>

Reviewed-by: Heiko Stuebner <heiko@sntech.de>