diff mbox series

PCI: exynos: simplify with PTR_ERR_OR_ZERO

Message ID 1599123916-65530-1-git-send-email-xuwei5@hisilicon.com (mailing list archive)
State New, archived
Headers show
Series PCI: exynos: simplify with PTR_ERR_OR_ZERO | expand

Commit Message

Wei Xu Sept. 3, 2020, 9:05 a.m. UTC
Use PTR_ERR_OR_ZERO to make the code a little bit simpler.
This code was detected with the help of Coccinelle.

Signed-off-by: Wei Xu <xuwei5@hisilicon.com>
---
 drivers/pci/controller/dwc/pci-exynos.c | 5 +----
 1 file changed, 1 insertion(+), 4 deletions(-)

Comments

Wei Xu Sept. 3, 2020, 12:29 p.m. UTC | #1
Hi All,

Sorry for the noise and please ignore it.
I found these kind of changes have been sent and rejected before.

Best Regards,
Wei

On 2020/9/3 17:05, Wei Xu wrote:
> Use PTR_ERR_OR_ZERO to make the code a little bit simpler.
> This code was detected with the help of Coccinelle.
> 
> Signed-off-by: Wei Xu <xuwei5@hisilicon.com>
> ---
>  drivers/pci/controller/dwc/pci-exynos.c | 5 +----
>  1 file changed, 1 insertion(+), 4 deletions(-)
> 
> diff --git a/drivers/pci/controller/dwc/pci-exynos.c b/drivers/pci/controller/dwc/pci-exynos.c
> index 8d82c43..f59f027 100644
> --- a/drivers/pci/controller/dwc/pci-exynos.c
> +++ b/drivers/pci/controller/dwc/pci-exynos.c
> @@ -90,10 +90,7 @@ static int exynos5440_pcie_get_mem_resources(struct platform_device *pdev,
>  		return -ENOMEM;
>  
>  	ep->mem_res->elbi_base = devm_platform_ioremap_resource(pdev, 0);
> -	if (IS_ERR(ep->mem_res->elbi_base))
> -		return PTR_ERR(ep->mem_res->elbi_base);
> -
> -	return 0;
> +	return PTR_ERR_OR_ZERO(ep->mem_res->elbi_base);
>  }
>  
>  static int exynos5440_pcie_get_clk_resources(struct exynos_pcie *ep)
>
diff mbox series

Patch

diff --git a/drivers/pci/controller/dwc/pci-exynos.c b/drivers/pci/controller/dwc/pci-exynos.c
index 8d82c43..f59f027 100644
--- a/drivers/pci/controller/dwc/pci-exynos.c
+++ b/drivers/pci/controller/dwc/pci-exynos.c
@@ -90,10 +90,7 @@  static int exynos5440_pcie_get_mem_resources(struct platform_device *pdev,
 		return -ENOMEM;
 
 	ep->mem_res->elbi_base = devm_platform_ioremap_resource(pdev, 0);
-	if (IS_ERR(ep->mem_res->elbi_base))
-		return PTR_ERR(ep->mem_res->elbi_base);
-
-	return 0;
+	return PTR_ERR_OR_ZERO(ep->mem_res->elbi_base);
 }
 
 static int exynos5440_pcie_get_clk_resources(struct exynos_pcie *ep)