All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH] PCI: dwc/meson: Use PTR_ERR_OR_ZERO
@ 2020-11-16 16:34 ` Sudip Mukherjee
  0 siblings, 0 replies; 7+ messages in thread
From: Sudip Mukherjee @ 2020-11-16 16:34 UTC (permalink / raw)
  To: Yue Wang, Lorenzo Pieralisi, Rob Herring, Bjorn Helgaas,
	Kevin Hilman, Neil Armstrong, Jerome Brunet, Martin Blumenstingl
  Cc: linux-kernel, linux-safety, linux-pci, linux-amlogic,
	linux-arm-kernel, Sudip Mukherjee

Coccinelle suggested using PTR_ERR_OR_ZERO() and looking at the code,
we can use PTR_ERR_OR_ZERO() instead of checking IS_ERR() and then
doing 'return 0'.

Signed-off-by: Sudip Mukherjee <sudipm.mukherjee@gmail.com>
---
 drivers/pci/controller/dwc/pci-meson.c | 8 ++------
 1 file changed, 2 insertions(+), 6 deletions(-)

diff --git a/drivers/pci/controller/dwc/pci-meson.c b/drivers/pci/controller/dwc/pci-meson.c
index 1913dc2c8fa0..f4261f5aceb1 100644
--- a/drivers/pci/controller/dwc/pci-meson.c
+++ b/drivers/pci/controller/dwc/pci-meson.c
@@ -115,10 +115,8 @@ static int meson_pcie_get_mems(struct platform_device *pdev,
 		return PTR_ERR(pci->dbi_base);
 
 	mp->cfg_base = devm_platform_ioremap_resource_byname(pdev, "cfg");
-	if (IS_ERR(mp->cfg_base))
-		return PTR_ERR(mp->cfg_base);
 
-	return 0;
+	return PTR_ERR_OR_ZERO(mp->cfg_base);
 }
 
 static int meson_pcie_power_on(struct meson_pcie *mp)
@@ -208,10 +206,8 @@ static int meson_pcie_probe_clocks(struct meson_pcie *mp)
 		return PTR_ERR(res->general_clk);
 
 	res->clk = meson_pcie_probe_clock(dev, "pclk", 0);
-	if (IS_ERR(res->clk))
-		return PTR_ERR(res->clk);
 
-	return 0;
+	return PTR_ERR_OR_ZERO(res->clk);
 }
 
 static inline u32 meson_cfg_readl(struct meson_pcie *mp, u32 reg)
-- 
2.11.0


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

* [PATCH] PCI: dwc/meson: Use PTR_ERR_OR_ZERO
@ 2020-11-16 16:34 ` Sudip Mukherjee
  0 siblings, 0 replies; 7+ messages in thread
From: Sudip Mukherjee @ 2020-11-16 16:34 UTC (permalink / raw)
  To: Yue Wang, Lorenzo Pieralisi, Rob Herring, Bjorn Helgaas,
	Kevin Hilman, Neil Armstrong, Jerome Brunet, Martin Blumenstingl
  Cc: linux-pci, linux-kernel, linux-amlogic, linux-safety,
	Sudip Mukherjee, linux-arm-kernel

Coccinelle suggested using PTR_ERR_OR_ZERO() and looking at the code,
we can use PTR_ERR_OR_ZERO() instead of checking IS_ERR() and then
doing 'return 0'.

Signed-off-by: Sudip Mukherjee <sudipm.mukherjee@gmail.com>
---
 drivers/pci/controller/dwc/pci-meson.c | 8 ++------
 1 file changed, 2 insertions(+), 6 deletions(-)

diff --git a/drivers/pci/controller/dwc/pci-meson.c b/drivers/pci/controller/dwc/pci-meson.c
index 1913dc2c8fa0..f4261f5aceb1 100644
--- a/drivers/pci/controller/dwc/pci-meson.c
+++ b/drivers/pci/controller/dwc/pci-meson.c
@@ -115,10 +115,8 @@ static int meson_pcie_get_mems(struct platform_device *pdev,
 		return PTR_ERR(pci->dbi_base);
 
 	mp->cfg_base = devm_platform_ioremap_resource_byname(pdev, "cfg");
-	if (IS_ERR(mp->cfg_base))
-		return PTR_ERR(mp->cfg_base);
 
-	return 0;
+	return PTR_ERR_OR_ZERO(mp->cfg_base);
 }
 
 static int meson_pcie_power_on(struct meson_pcie *mp)
@@ -208,10 +206,8 @@ static int meson_pcie_probe_clocks(struct meson_pcie *mp)
 		return PTR_ERR(res->general_clk);
 
 	res->clk = meson_pcie_probe_clock(dev, "pclk", 0);
-	if (IS_ERR(res->clk))
-		return PTR_ERR(res->clk);
 
-	return 0;
+	return PTR_ERR_OR_ZERO(res->clk);
 }
 
 static inline u32 meson_cfg_readl(struct meson_pcie *mp, u32 reg)
-- 
2.11.0


_______________________________________________
linux-arm-kernel mailing list
linux-arm-kernel@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/linux-arm-kernel

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

* [PATCH] PCI: dwc/meson: Use PTR_ERR_OR_ZERO
@ 2020-11-16 16:34 ` Sudip Mukherjee
  0 siblings, 0 replies; 7+ messages in thread
From: Sudip Mukherjee @ 2020-11-16 16:34 UTC (permalink / raw)
  To: Yue Wang, Lorenzo Pieralisi, Rob Herring, Bjorn Helgaas,
	Kevin Hilman, Neil Armstrong, Jerome Brunet, Martin Blumenstingl
  Cc: linux-pci, linux-kernel, linux-amlogic, linux-safety,
	Sudip Mukherjee, linux-arm-kernel

Coccinelle suggested using PTR_ERR_OR_ZERO() and looking at the code,
we can use PTR_ERR_OR_ZERO() instead of checking IS_ERR() and then
doing 'return 0'.

Signed-off-by: Sudip Mukherjee <sudipm.mukherjee@gmail.com>
---
 drivers/pci/controller/dwc/pci-meson.c | 8 ++------
 1 file changed, 2 insertions(+), 6 deletions(-)

diff --git a/drivers/pci/controller/dwc/pci-meson.c b/drivers/pci/controller/dwc/pci-meson.c
index 1913dc2c8fa0..f4261f5aceb1 100644
--- a/drivers/pci/controller/dwc/pci-meson.c
+++ b/drivers/pci/controller/dwc/pci-meson.c
@@ -115,10 +115,8 @@ static int meson_pcie_get_mems(struct platform_device *pdev,
 		return PTR_ERR(pci->dbi_base);
 
 	mp->cfg_base = devm_platform_ioremap_resource_byname(pdev, "cfg");
-	if (IS_ERR(mp->cfg_base))
-		return PTR_ERR(mp->cfg_base);
 
-	return 0;
+	return PTR_ERR_OR_ZERO(mp->cfg_base);
 }
 
 static int meson_pcie_power_on(struct meson_pcie *mp)
@@ -208,10 +206,8 @@ static int meson_pcie_probe_clocks(struct meson_pcie *mp)
 		return PTR_ERR(res->general_clk);
 
 	res->clk = meson_pcie_probe_clock(dev, "pclk", 0);
-	if (IS_ERR(res->clk))
-		return PTR_ERR(res->clk);
 
-	return 0;
+	return PTR_ERR_OR_ZERO(res->clk);
 }
 
 static inline u32 meson_cfg_readl(struct meson_pcie *mp, u32 reg)
-- 
2.11.0


_______________________________________________
linux-amlogic mailing list
linux-amlogic@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/linux-amlogic

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

* Re: [PATCH] PCI: dwc/meson: Use PTR_ERR_OR_ZERO
  2020-11-16 16:34 ` Sudip Mukherjee
  (?)
  (?)
@ 2020-11-17  8:36   ` Neil Armstrong
  -1 siblings, 0 replies; 7+ messages in thread
From: Neil Armstrong @ 2020-11-17  8:36 UTC (permalink / raw)
  To: Sudip Mukherjee, Yue Wang, Lorenzo Pieralisi, Rob Herring,
	Bjorn Helgaas, Kevin Hilman, Jerome Brunet, Martin Blumenstingl
  Cc: linux-kernel, linux-safety, linux-pci, linux-amlogic, linux-arm-kernel

On 16/11/2020 17:34, Sudip Mukherjee wrote:
> Coccinelle suggested using PTR_ERR_OR_ZERO() and looking at the code,
> we can use PTR_ERR_OR_ZERO() instead of checking IS_ERR() and then
> doing 'return 0'.
> 
> Signed-off-by: Sudip Mukherjee <sudipm.mukherjee@gmail.com>
> ---
>  drivers/pci/controller/dwc/pci-meson.c | 8 ++------
>  1 file changed, 2 insertions(+), 6 deletions(-)
> 
> diff --git a/drivers/pci/controller/dwc/pci-meson.c b/drivers/pci/controller/dwc/pci-meson.c
> index 1913dc2c8fa0..f4261f5aceb1 100644
> --- a/drivers/pci/controller/dwc/pci-meson.c
> +++ b/drivers/pci/controller/dwc/pci-meson.c
> @@ -115,10 +115,8 @@ static int meson_pcie_get_mems(struct platform_device *pdev,
>  		return PTR_ERR(pci->dbi_base);
>  
>  	mp->cfg_base = devm_platform_ioremap_resource_byname(pdev, "cfg");
> -	if (IS_ERR(mp->cfg_base))
> -		return PTR_ERR(mp->cfg_base);
>  
> -	return 0;
> +	return PTR_ERR_OR_ZERO(mp->cfg_base);
>  }
>  
>  static int meson_pcie_power_on(struct meson_pcie *mp)
> @@ -208,10 +206,8 @@ static int meson_pcie_probe_clocks(struct meson_pcie *mp)
>  		return PTR_ERR(res->general_clk);
>  
>  	res->clk = meson_pcie_probe_clock(dev, "pclk", 0);
> -	if (IS_ERR(res->clk))
> -		return PTR_ERR(res->clk);
>  
> -	return 0;
> +	return PTR_ERR_OR_ZERO(res->clk);
>  }
>  
>  static inline u32 meson_cfg_readl(struct meson_pcie *mp, u32 reg)
> 

Hi,

This has been nacked multiple times already:
https://lore.kernel.org/linux-pci/20190527140952.GB7202@ulmo/

Neil

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

* Re: [PATCH] PCI: dwc/meson: Use PTR_ERR_OR_ZERO
@ 2020-11-17  8:36   ` Neil Armstrong
  0 siblings, 0 replies; 7+ messages in thread
From: Neil Armstrong @ 2020-11-17  8:36 UTC (permalink / raw)
  To: Sudip Mukherjee, Yue Wang, Lorenzo Pieralisi, Rob Herring,
	Bjorn Helgaas, Kevin Hilman, Jerome Brunet, Martin Blumenstingl
  Cc: linux-pci, linux-safety, linux-kernel, linux-arm-kernel, linux-amlogic

On 16/11/2020 17:34, Sudip Mukherjee wrote:
> Coccinelle suggested using PTR_ERR_OR_ZERO() and looking at the code,
> we can use PTR_ERR_OR_ZERO() instead of checking IS_ERR() and then
> doing 'return 0'.
> 
> Signed-off-by: Sudip Mukherjee <sudipm.mukherjee@gmail.com>
> ---
>  drivers/pci/controller/dwc/pci-meson.c | 8 ++------
>  1 file changed, 2 insertions(+), 6 deletions(-)
> 
> diff --git a/drivers/pci/controller/dwc/pci-meson.c b/drivers/pci/controller/dwc/pci-meson.c
> index 1913dc2c8fa0..f4261f5aceb1 100644
> --- a/drivers/pci/controller/dwc/pci-meson.c
> +++ b/drivers/pci/controller/dwc/pci-meson.c
> @@ -115,10 +115,8 @@ static int meson_pcie_get_mems(struct platform_device *pdev,
>  		return PTR_ERR(pci->dbi_base);
>  
>  	mp->cfg_base = devm_platform_ioremap_resource_byname(pdev, "cfg");
> -	if (IS_ERR(mp->cfg_base))
> -		return PTR_ERR(mp->cfg_base);
>  
> -	return 0;
> +	return PTR_ERR_OR_ZERO(mp->cfg_base);
>  }
>  
>  static int meson_pcie_power_on(struct meson_pcie *mp)
> @@ -208,10 +206,8 @@ static int meson_pcie_probe_clocks(struct meson_pcie *mp)
>  		return PTR_ERR(res->general_clk);
>  
>  	res->clk = meson_pcie_probe_clock(dev, "pclk", 0);
> -	if (IS_ERR(res->clk))
> -		return PTR_ERR(res->clk);
>  
> -	return 0;
> +	return PTR_ERR_OR_ZERO(res->clk);
>  }
>  
>  static inline u32 meson_cfg_readl(struct meson_pcie *mp, u32 reg)
> 

Hi,

This has been nacked multiple times already:
https://lore.kernel.org/linux-pci/20190527140952.GB7202@ulmo/

Neil

_______________________________________________
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] 7+ messages in thread

* Re: [linux-safety] [PATCH] PCI: dwc/meson: Use PTR_ERR_OR_ZERO
@ 2020-11-17  8:36   ` Neil Armstrong
  0 siblings, 0 replies; 7+ messages in thread
From: Neil Armstrong @ 2020-11-17  8:36 UTC (permalink / raw)
  To: Sudip Mukherjee, Yue Wang, Lorenzo Pieralisi, Rob Herring,
	Bjorn Helgaas, Kevin Hilman, Jerome Brunet, Martin Blumenstingl
  Cc: linux-kernel, linux-safety, linux-pci, linux-amlogic, linux-arm-kernel

On 16/11/2020 17:34, Sudip Mukherjee wrote:
> Coccinelle suggested using PTR_ERR_OR_ZERO() and looking at the code,
> we can use PTR_ERR_OR_ZERO() instead of checking IS_ERR() and then
> doing 'return 0'.
> 
> Signed-off-by: Sudip Mukherjee <sudipm.mukherjee@gmail.com>
> ---
>  drivers/pci/controller/dwc/pci-meson.c | 8 ++------
>  1 file changed, 2 insertions(+), 6 deletions(-)
> 
> diff --git a/drivers/pci/controller/dwc/pci-meson.c b/drivers/pci/controller/dwc/pci-meson.c
> index 1913dc2c8fa0..f4261f5aceb1 100644
> --- a/drivers/pci/controller/dwc/pci-meson.c
> +++ b/drivers/pci/controller/dwc/pci-meson.c
> @@ -115,10 +115,8 @@ static int meson_pcie_get_mems(struct platform_device *pdev,
>  		return PTR_ERR(pci->dbi_base);
>  
>  	mp->cfg_base = devm_platform_ioremap_resource_byname(pdev, "cfg");
> -	if (IS_ERR(mp->cfg_base))
> -		return PTR_ERR(mp->cfg_base);
>  
> -	return 0;
> +	return PTR_ERR_OR_ZERO(mp->cfg_base);
>  }
>  
>  static int meson_pcie_power_on(struct meson_pcie *mp)
> @@ -208,10 +206,8 @@ static int meson_pcie_probe_clocks(struct meson_pcie *mp)
>  		return PTR_ERR(res->general_clk);
>  
>  	res->clk = meson_pcie_probe_clock(dev, "pclk", 0);
> -	if (IS_ERR(res->clk))
> -		return PTR_ERR(res->clk);
>  
> -	return 0;
> +	return PTR_ERR_OR_ZERO(res->clk);
>  }
>  
>  static inline u32 meson_cfg_readl(struct meson_pcie *mp, u32 reg)
> 

Hi,

This has been nacked multiple times already:
https://lore.kernel.org/linux-pci/20190527140952.GB7202@ulmo/

Neil


-=-=-=-=-=-=-=-=-=-=-=-
Links: You receive all messages sent to this group.
View/Reply Online (#182): https://lists.elisa.tech/g/linux-safety/message/182
Mute This Topic: https://lists.elisa.tech/mt/78295847/5278000
Group Owner: linux-safety+owner@lists.elisa.tech
Unsubscribe: https://lists.elisa.tech/g/linux-safety/unsub [linux-safety@archiver.kernel.org]
-=-=-=-=-=-=-=-=-=-=-=-



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

* Re: [PATCH] PCI: dwc/meson: Use PTR_ERR_OR_ZERO
@ 2020-11-17  8:36   ` Neil Armstrong
  0 siblings, 0 replies; 7+ messages in thread
From: Neil Armstrong @ 2020-11-17  8:36 UTC (permalink / raw)
  To: Sudip Mukherjee, Yue Wang, Lorenzo Pieralisi, Rob Herring,
	Bjorn Helgaas, Kevin Hilman, Jerome Brunet, Martin Blumenstingl
  Cc: linux-pci, linux-safety, linux-kernel, linux-arm-kernel, linux-amlogic

On 16/11/2020 17:34, Sudip Mukherjee wrote:
> Coccinelle suggested using PTR_ERR_OR_ZERO() and looking at the code,
> we can use PTR_ERR_OR_ZERO() instead of checking IS_ERR() and then
> doing 'return 0'.
> 
> Signed-off-by: Sudip Mukherjee <sudipm.mukherjee@gmail.com>
> ---
>  drivers/pci/controller/dwc/pci-meson.c | 8 ++------
>  1 file changed, 2 insertions(+), 6 deletions(-)
> 
> diff --git a/drivers/pci/controller/dwc/pci-meson.c b/drivers/pci/controller/dwc/pci-meson.c
> index 1913dc2c8fa0..f4261f5aceb1 100644
> --- a/drivers/pci/controller/dwc/pci-meson.c
> +++ b/drivers/pci/controller/dwc/pci-meson.c
> @@ -115,10 +115,8 @@ static int meson_pcie_get_mems(struct platform_device *pdev,
>  		return PTR_ERR(pci->dbi_base);
>  
>  	mp->cfg_base = devm_platform_ioremap_resource_byname(pdev, "cfg");
> -	if (IS_ERR(mp->cfg_base))
> -		return PTR_ERR(mp->cfg_base);
>  
> -	return 0;
> +	return PTR_ERR_OR_ZERO(mp->cfg_base);
>  }
>  
>  static int meson_pcie_power_on(struct meson_pcie *mp)
> @@ -208,10 +206,8 @@ static int meson_pcie_probe_clocks(struct meson_pcie *mp)
>  		return PTR_ERR(res->general_clk);
>  
>  	res->clk = meson_pcie_probe_clock(dev, "pclk", 0);
> -	if (IS_ERR(res->clk))
> -		return PTR_ERR(res->clk);
>  
> -	return 0;
> +	return PTR_ERR_OR_ZERO(res->clk);
>  }
>  
>  static inline u32 meson_cfg_readl(struct meson_pcie *mp, u32 reg)
> 

Hi,

This has been nacked multiple times already:
https://lore.kernel.org/linux-pci/20190527140952.GB7202@ulmo/

Neil

_______________________________________________
linux-amlogic mailing list
linux-amlogic@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/linux-amlogic

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

end of thread, other threads:[~2020-11-20 17:58 UTC | newest]

Thread overview: 7+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2020-11-16 16:34 [PATCH] PCI: dwc/meson: Use PTR_ERR_OR_ZERO Sudip Mukherjee
2020-11-16 16:34 ` Sudip Mukherjee
2020-11-16 16:34 ` Sudip Mukherjee
2020-11-17  8:36 ` Neil Armstrong
2020-11-17  8:36   ` Neil Armstrong
2020-11-17  8:36   ` [linux-safety] " Neil Armstrong
2020-11-17  8:36   ` Neil Armstrong

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.