linux-kernel.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* drivers/pci/controller/pci-tegra.c:1365:1-3: WARNING: PTR_ERR_OR_ZERO can be used
@ 2019-12-27 12:18 kbuild test robot
  2019-12-27 12:18 ` [PATCH] PCI: fix ptr_ret.cocci warnings kbuild test robot
  0 siblings, 1 reply; 10+ messages in thread
From: kbuild test robot @ 2019-12-27 12:18 UTC (permalink / raw)
  To: Palmer Dabbelt; +Cc: kbuild-all, linux-kernel, Bjorn Helgaas, Michal Simek

tree:   https://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git master
head:   46cf053efec6a3a5f343fead837777efe8252a46
commit: 191d6f91f283dfb007499bb8529d54c3ac434bd7 PCI: Remove PCI_MSI_IRQ_DOMAIN architecture whitelist
date:   4 weeks ago

If you fix the issue, kindly add following tag
Reported-by: kbuild test robot <lkp@intel.com>


coccinelle warnings: (new ones prefixed by >>)

>> drivers/pci/controller/pci-tegra.c:1365:1-3: WARNING: PTR_ERR_OR_ZERO can be used

Please review and possibly fold the followup patch.

---
0-DAY kernel test infrastructure                 Open Source Technology Center
https://lists.01.org/hyperkitty/list/kbuild-all@lists.01.org Intel Corporation

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

* [PATCH] PCI: fix ptr_ret.cocci warnings
  2019-12-27 12:18 drivers/pci/controller/pci-tegra.c:1365:1-3: WARNING: PTR_ERR_OR_ZERO can be used kbuild test robot
@ 2019-12-27 12:18 ` kbuild test robot
  0 siblings, 0 replies; 10+ messages in thread
From: kbuild test robot @ 2019-12-27 12:18 UTC (permalink / raw)
  To: Palmer Dabbelt
  Cc: kbuild-all, linux-kernel, Bjorn Helgaas, Michal Simek,
	Thierry Reding, Lorenzo Pieralisi, Andrew Murray,
	Jonathan Hunter, linux-tegra, linux-pci

From: kbuild test robot <lkp@intel.com>

drivers/pci/controller/pci-tegra.c:1365:1-3: WARNING: PTR_ERR_OR_ZERO can be used


 Use PTR_ERR_OR_ZERO rather than if(IS_ERR(...)) + PTR_ERR

Generated by: scripts/coccinelle/api/ptr_ret.cocci

Fixes: 191d6f91f283 ("PCI: Remove PCI_MSI_IRQ_DOMAIN architecture whitelist")
CC: Palmer Dabbelt <palmer@sifive.com>
Signed-off-by: kbuild test robot <lkp@intel.com>
---

tree:   https://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git master
head:   46cf053efec6a3a5f343fead837777efe8252a46
commit: 191d6f91f283dfb007499bb8529d54c3ac434bd7 PCI: Remove PCI_MSI_IRQ_DOMAIN architecture whitelist

 pci-tegra.c |    5 +----
 1 file changed, 1 insertion(+), 4 deletions(-)

--- a/drivers/pci/controller/pci-tegra.c
+++ b/drivers/pci/controller/pci-tegra.c
@@ -1362,10 +1362,7 @@ static int tegra_pcie_resets_get(struct
 		return PTR_ERR(pcie->afi_rst);
 
 	pcie->pcie_xrst = devm_reset_control_get_exclusive(dev, "pcie_x");
-	if (IS_ERR(pcie->pcie_xrst))
-		return PTR_ERR(pcie->pcie_xrst);
-
-	return 0;
+	return PTR_ERR_OR_ZERO(pcie->pcie_xrst);
 }
 
 static int tegra_pcie_phys_get_legacy(struct tegra_pcie *pcie)

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

* [PATCH] PCI: fix ptr_ret.cocci warnings
  2020-01-05  7:21 drivers/pci/controller/dwc/pci-exynos.c:95:1-3: WARNING: PTR_ERR_OR_ZERO can be used kbuild test robot
@ 2020-01-05  7:21 ` kbuild test robot
  0 siblings, 0 replies; 10+ messages in thread
From: kbuild test robot @ 2020-01-05  7:21 UTC (permalink / raw)
  To: Palmer Dabbelt
  Cc: kbuild-all, linux-kernel, Bjorn Helgaas, Michal Simek,
	Jingoo Han, Lorenzo Pieralisi, Andrew Murray, Kukjin Kim,
	Krzysztof Kozlowski, linux-pci, linux-arm-kernel

From: kbuild test robot <lkp@intel.com>

drivers/pci/controller/dwc/pci-exynos.c:95:1-3: WARNING: PTR_ERR_OR_ZERO can be used


 Use PTR_ERR_OR_ZERO rather than if(IS_ERR(...)) + PTR_ERR

Generated by: scripts/coccinelle/api/ptr_ret.cocci

Fixes: 191d6f91f283 ("PCI: Remove PCI_MSI_IRQ_DOMAIN architecture whitelist")
CC: Palmer Dabbelt <palmer@sifive.com>
Signed-off-by: kbuild test robot <lkp@intel.com>
---

tree:   https://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git master
head:   36487907f34131c7e3df5b1e6b30b4e3dfcdc0af
commit: 191d6f91f283dfb007499bb8529d54c3ac434bd7 PCI: Remove PCI_MSI_IRQ_DOMAIN architecture whitelist

 pci-exynos.c |    5 +----
 1 file changed, 1 insertion(+), 4 deletions(-)

--- a/drivers/pci/controller/dwc/pci-exynos.c
+++ b/drivers/pci/controller/dwc/pci-exynos.c
@@ -92,10 +92,7 @@ static int exynos5440_pcie_get_mem_resou
 
 	res = platform_get_resource(pdev, IORESOURCE_MEM, 0);
 	ep->mem_res->elbi_base = devm_ioremap_resource(dev, res);
-	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)

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

* RE: [PATCH] PCI: fix ptr_ret.cocci warnings
  2018-09-18 14:21   ` Lorenzo Pieralisi
@ 2018-09-19  0:40     ` Songxiaowei (Kirin_DRV)
  0 siblings, 0 replies; 10+ messages in thread
From: Songxiaowei (Kirin_DRV) @ 2018-09-19  0:40 UTC (permalink / raw)
  To: Lorenzo Pieralisi, kbuild test robot, Wangbinghui (Biggio, Kirin_DRV)
  Cc: Shawn Lin, kbuild-all, linux-kernel, Bjorn Helgaas

That's OK, and thank a lot.

> -----Original Message-----
> From: Lorenzo Pieralisi [mailto:lorenzo.pieralisi@arm.com]
> Sent: Tuesday, September 18, 2018 10:21 PM
> To: kbuild test robot <fengguang.wu@intel.com>; Songxiaowei (Kirin_DRV)
> <songxiaowei@hisilicon.com>; Wangbinghui (Biggio, Kirin_DRV)
> <wangbinghui@hisilicon.com>
> Cc: Shawn Lin <shawn.lin@rock-chips.com>; kbuild-all@01.org;
> linux-kernel@vger.kernel.org; Bjorn Helgaas <helgaas@kernel.org>
> Subject: Re: [PATCH] PCI: fix ptr_ret.cocci warnings
> 
> On Fri, Jul 20, 2018 at 07:42:43AM +0800, kbuild test robot wrote:
> > From: kbuild test robot <fengguang.wu@intel.com>
> >
> > drivers/pci/controller/dwc/pcie-kirin.c:141:1-3: WARNING:
> > PTR_ERR_OR_ZERO can be used
> > drivers/pci/controller/dwc/pcie-kirin.c:177:1-3: WARNING:
> > PTR_ERR_OR_ZERO can be used
> >
> >
> >  Use PTR_ERR_OR_ZERO rather than if(IS_ERR(...)) + PTR_ERR
> >
> > Generated by: scripts/coccinelle/api/ptr_ret.cocci
> >
> > Fixes: 6e0832fa432e ("PCI: Collect all native drivers under
> > drivers/pci/controller/")
> > CC: Shawn Lin <shawn.lin@rock-chips.com>
> > Signed-off-by: kbuild test robot <fengguang.wu@intel.com>
> > ---
> >
> >  pcie-kirin.c |   10 ++--------
> >  1 file changed, 2 insertions(+), 8 deletions(-)
> 
> Xiaowei, Binghui,
> 
> are you OK with this change ? I will remove the Fixes: tag from the patch.
> 
> Let me know, thanks.
> 
> Lorenzo
> 
> > --- a/drivers/pci/controller/dwc/pcie-kirin.c
> > +++ b/drivers/pci/controller/dwc/pcie-kirin.c
> > @@ -138,10 +138,7 @@ static long kirin_pcie_get_clk(struct ki
> >  		return PTR_ERR(kirin_pcie->apb_sys_clk);
> >
> >  	kirin_pcie->pcie_aclk = devm_clk_get(dev, "pcie_aclk");
> > -	if (IS_ERR(kirin_pcie->pcie_aclk))
> > -		return PTR_ERR(kirin_pcie->pcie_aclk);
> > -
> > -	return 0;
> > +	return PTR_ERR_OR_ZERO(kirin_pcie->pcie_aclk);
> >  }
> >
> >  static long kirin_pcie_get_resource(struct kirin_pcie *kirin_pcie, @@
> > -174,10 +171,7 @@ static long kirin_pcie_get_resource(stru
> >
> >  	kirin_pcie->sysctrl =
> >  		syscon_regmap_lookup_by_compatible("hisilicon,hi3660-sctrl");
> > -	if (IS_ERR(kirin_pcie->sysctrl))
> > -		return PTR_ERR(kirin_pcie->sysctrl);
> > -
> > -	return 0;
> > +	return PTR_ERR_OR_ZERO(kirin_pcie->sysctrl);
> >  }
> >
> >  static int kirin_pcie_phy_init(struct kirin_pcie *kirin_pcie)

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

* Re: [PATCH] PCI: fix ptr_ret.cocci warnings
  2018-09-18 14:47     ` Thierry Reding
@ 2018-09-18 16:30       ` Lorenzo Pieralisi
  0 siblings, 0 replies; 10+ messages in thread
From: Lorenzo Pieralisi @ 2018-09-18 16:30 UTC (permalink / raw)
  To: Thierry Reding
  Cc: kbuild test robot, Shawn Lin, kbuild-all, linux-kernel,
	Bjorn Helgaas, Jonathan Hunter, linux-tegra, linux-pci

On Tue, Sep 18, 2018 at 04:47:37PM +0200, Thierry Reding wrote:
> On Tue, Sep 18, 2018 at 03:18:38PM +0100, Lorenzo Pieralisi wrote:
> > On Thu, Jul 12, 2018 at 07:30:41AM +0800, kbuild test robot wrote:
> > > From: kbuild test robot <fengguang.wu@intel.com>
> > > 
> > > drivers/pci/controller/pci-tegra.c:1132:1-3: WARNING: PTR_ERR_OR_ZERO can be used
> > > 
> > > 
> > >  Use PTR_ERR_OR_ZERO rather than if(IS_ERR(...)) + PTR_ERR
> > > 
> > > Generated by: scripts/coccinelle/api/ptr_ret.cocci
> > > 
> > > Fixes: 6e0832fa432e ("PCI: Collect all native drivers under drivers/pci/controller/")
> > > CC: Shawn Lin <shawn.lin@rock-chips.com>
> > > Signed-off-by: kbuild test robot <fengguang.wu@intel.com>
> > > ---
> > > 
> > >  pci-tegra.c |    5 +----
> > >  1 file changed, 1 insertion(+), 4 deletions(-)
> > 
> > Thierry,
> > 
> > are you OK with this change ? I will remove the Fixes: tag since
> > this does not fix anything AFAICS.
> 
> This has been proposed several times in the past and each time Bjorn and
> I have agreed that we'd rather not merge that change. I think the
> original is clearer and allows the code to be more easily extended.
> 
> I don't know if there's a way to "whitelist" certain drivers or sub-
> systems where these kinds of changes are known not to be desired. Or
> perhaps there's some way to trick coccinelle into not recognizing this
> particular instance.
> 
> Then again, it seems wrong to have to work around over-ambitious
> semantic patches...

I agree with you and Bjorn, I will drop the patches but you have a
point. Certainly these patches aren't fixing anything unless I am
missing something obvious.

Lorenzo

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

* Re: [PATCH] PCI: fix ptr_ret.cocci warnings
  2018-09-18 14:18   ` Lorenzo Pieralisi
@ 2018-09-18 14:47     ` Thierry Reding
  2018-09-18 16:30       ` Lorenzo Pieralisi
  0 siblings, 1 reply; 10+ messages in thread
From: Thierry Reding @ 2018-09-18 14:47 UTC (permalink / raw)
  To: Lorenzo Pieralisi
  Cc: kbuild test robot, Shawn Lin, kbuild-all, linux-kernel,
	Bjorn Helgaas, Jonathan Hunter, linux-tegra, linux-pci

[-- Attachment #1: Type: text/plain, Size: 1402 bytes --]

On Tue, Sep 18, 2018 at 03:18:38PM +0100, Lorenzo Pieralisi wrote:
> On Thu, Jul 12, 2018 at 07:30:41AM +0800, kbuild test robot wrote:
> > From: kbuild test robot <fengguang.wu@intel.com>
> > 
> > drivers/pci/controller/pci-tegra.c:1132:1-3: WARNING: PTR_ERR_OR_ZERO can be used
> > 
> > 
> >  Use PTR_ERR_OR_ZERO rather than if(IS_ERR(...)) + PTR_ERR
> > 
> > Generated by: scripts/coccinelle/api/ptr_ret.cocci
> > 
> > Fixes: 6e0832fa432e ("PCI: Collect all native drivers under drivers/pci/controller/")
> > CC: Shawn Lin <shawn.lin@rock-chips.com>
> > Signed-off-by: kbuild test robot <fengguang.wu@intel.com>
> > ---
> > 
> >  pci-tegra.c |    5 +----
> >  1 file changed, 1 insertion(+), 4 deletions(-)
> 
> Thierry,
> 
> are you OK with this change ? I will remove the Fixes: tag since
> this does not fix anything AFAICS.

This has been proposed several times in the past and each time Bjorn and
I have agreed that we'd rather not merge that change. I think the
original is clearer and allows the code to be more easily extended.

I don't know if there's a way to "whitelist" certain drivers or sub-
systems where these kinds of changes are known not to be desired. Or
perhaps there's some way to trick coccinelle into not recognizing this
particular instance.

Then again, it seems wrong to have to work around over-ambitious
semantic patches...

Thierry

[-- Attachment #2: signature.asc --]
[-- Type: application/pgp-signature, Size: 833 bytes --]

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

* Re: [PATCH] PCI: fix ptr_ret.cocci warnings
  2018-07-19 23:42 ` [PATCH] PCI: fix ptr_ret.cocci warnings kbuild test robot
@ 2018-09-18 14:21   ` Lorenzo Pieralisi
  2018-09-19  0:40     ` Songxiaowei (Kirin_DRV)
  0 siblings, 1 reply; 10+ messages in thread
From: Lorenzo Pieralisi @ 2018-09-18 14:21 UTC (permalink / raw)
  To: kbuild test robot, Xiaowei Song, Binghui Wang
  Cc: Shawn Lin, kbuild-all, linux-kernel, Bjorn Helgaas

On Fri, Jul 20, 2018 at 07:42:43AM +0800, kbuild test robot wrote:
> From: kbuild test robot <fengguang.wu@intel.com>
> 
> drivers/pci/controller/dwc/pcie-kirin.c:141:1-3: WARNING: PTR_ERR_OR_ZERO can be used
> drivers/pci/controller/dwc/pcie-kirin.c:177:1-3: WARNING: PTR_ERR_OR_ZERO can be used
> 
> 
>  Use PTR_ERR_OR_ZERO rather than if(IS_ERR(...)) + PTR_ERR
> 
> Generated by: scripts/coccinelle/api/ptr_ret.cocci
> 
> Fixes: 6e0832fa432e ("PCI: Collect all native drivers under drivers/pci/controller/")
> CC: Shawn Lin <shawn.lin@rock-chips.com>
> Signed-off-by: kbuild test robot <fengguang.wu@intel.com>
> ---
> 
>  pcie-kirin.c |   10 ++--------
>  1 file changed, 2 insertions(+), 8 deletions(-)

Xiaowei, Binghui,

are you OK with this change ? I will remove the Fixes: tag from the
patch.

Let me know, thanks.

Lorenzo

> --- a/drivers/pci/controller/dwc/pcie-kirin.c
> +++ b/drivers/pci/controller/dwc/pcie-kirin.c
> @@ -138,10 +138,7 @@ static long kirin_pcie_get_clk(struct ki
>  		return PTR_ERR(kirin_pcie->apb_sys_clk);
>  
>  	kirin_pcie->pcie_aclk = devm_clk_get(dev, "pcie_aclk");
> -	if (IS_ERR(kirin_pcie->pcie_aclk))
> -		return PTR_ERR(kirin_pcie->pcie_aclk);
> -
> -	return 0;
> +	return PTR_ERR_OR_ZERO(kirin_pcie->pcie_aclk);
>  }
>  
>  static long kirin_pcie_get_resource(struct kirin_pcie *kirin_pcie,
> @@ -174,10 +171,7 @@ static long kirin_pcie_get_resource(stru
>  
>  	kirin_pcie->sysctrl =
>  		syscon_regmap_lookup_by_compatible("hisilicon,hi3660-sctrl");
> -	if (IS_ERR(kirin_pcie->sysctrl))
> -		return PTR_ERR(kirin_pcie->sysctrl);
> -
> -	return 0;
> +	return PTR_ERR_OR_ZERO(kirin_pcie->sysctrl);
>  }
>  
>  static int kirin_pcie_phy_init(struct kirin_pcie *kirin_pcie)

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

* Re: [PATCH] PCI: fix ptr_ret.cocci warnings
  2018-07-11 23:30 ` [PATCH] PCI: fix ptr_ret.cocci warnings kbuild test robot
@ 2018-09-18 14:18   ` Lorenzo Pieralisi
  2018-09-18 14:47     ` Thierry Reding
  0 siblings, 1 reply; 10+ messages in thread
From: Lorenzo Pieralisi @ 2018-09-18 14:18 UTC (permalink / raw)
  To: kbuild test robot, thierry.reding
  Cc: Shawn Lin, kbuild-all, linux-kernel, Bjorn Helgaas,
	Jonathan Hunter, linux-tegra, linux-pci

On Thu, Jul 12, 2018 at 07:30:41AM +0800, kbuild test robot wrote:
> From: kbuild test robot <fengguang.wu@intel.com>
> 
> drivers/pci/controller/pci-tegra.c:1132:1-3: WARNING: PTR_ERR_OR_ZERO can be used
> 
> 
>  Use PTR_ERR_OR_ZERO rather than if(IS_ERR(...)) + PTR_ERR
> 
> Generated by: scripts/coccinelle/api/ptr_ret.cocci
> 
> Fixes: 6e0832fa432e ("PCI: Collect all native drivers under drivers/pci/controller/")
> CC: Shawn Lin <shawn.lin@rock-chips.com>
> Signed-off-by: kbuild test robot <fengguang.wu@intel.com>
> ---
> 
>  pci-tegra.c |    5 +----
>  1 file changed, 1 insertion(+), 4 deletions(-)

Thierry,

are you OK with this change ? I will remove the Fixes: tag since
this does not fix anything AFAICS.

Lorenzo

> --- a/drivers/pci/controller/pci-tegra.c
> +++ b/drivers/pci/controller/pci-tegra.c
> @@ -1129,10 +1129,7 @@ static int tegra_pcie_resets_get(struct
>  		return PTR_ERR(pcie->afi_rst);
>  
>  	pcie->pcie_xrst = devm_reset_control_get_exclusive(dev, "pcie_x");
> -	if (IS_ERR(pcie->pcie_xrst))
> -		return PTR_ERR(pcie->pcie_xrst);
> -
> -	return 0;
> +	return PTR_ERR_OR_ZERO(pcie->pcie_xrst);
>  }
>  
>  static int tegra_pcie_phys_get_legacy(struct tegra_pcie *pcie)

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

* [PATCH] PCI: fix ptr_ret.cocci warnings
  2018-07-19 23:42 drivers/pci/controller/dwc/pcie-kirin.c:141:1-3: WARNING: PTR_ERR_OR_ZERO can be used kbuild test robot
@ 2018-07-19 23:42 ` kbuild test robot
  2018-09-18 14:21   ` Lorenzo Pieralisi
  0 siblings, 1 reply; 10+ messages in thread
From: kbuild test robot @ 2018-07-19 23:42 UTC (permalink / raw)
  To: Shawn Lin
  Cc: kbuild-all, linux-kernel, Bjorn Helgaas, Xiaowei Song,
	Binghui Wang, Lorenzo Pieralisi, linux-pci

From: kbuild test robot <fengguang.wu@intel.com>

drivers/pci/controller/dwc/pcie-kirin.c:141:1-3: WARNING: PTR_ERR_OR_ZERO can be used
drivers/pci/controller/dwc/pcie-kirin.c:177:1-3: WARNING: PTR_ERR_OR_ZERO can be used


 Use PTR_ERR_OR_ZERO rather than if(IS_ERR(...)) + PTR_ERR

Generated by: scripts/coccinelle/api/ptr_ret.cocci

Fixes: 6e0832fa432e ("PCI: Collect all native drivers under drivers/pci/controller/")
CC: Shawn Lin <shawn.lin@rock-chips.com>
Signed-off-by: kbuild test robot <fengguang.wu@intel.com>
---

 pcie-kirin.c |   10 ++--------
 1 file changed, 2 insertions(+), 8 deletions(-)

--- a/drivers/pci/controller/dwc/pcie-kirin.c
+++ b/drivers/pci/controller/dwc/pcie-kirin.c
@@ -138,10 +138,7 @@ static long kirin_pcie_get_clk(struct ki
 		return PTR_ERR(kirin_pcie->apb_sys_clk);
 
 	kirin_pcie->pcie_aclk = devm_clk_get(dev, "pcie_aclk");
-	if (IS_ERR(kirin_pcie->pcie_aclk))
-		return PTR_ERR(kirin_pcie->pcie_aclk);
-
-	return 0;
+	return PTR_ERR_OR_ZERO(kirin_pcie->pcie_aclk);
 }
 
 static long kirin_pcie_get_resource(struct kirin_pcie *kirin_pcie,
@@ -174,10 +171,7 @@ static long kirin_pcie_get_resource(stru
 
 	kirin_pcie->sysctrl =
 		syscon_regmap_lookup_by_compatible("hisilicon,hi3660-sctrl");
-	if (IS_ERR(kirin_pcie->sysctrl))
-		return PTR_ERR(kirin_pcie->sysctrl);
-
-	return 0;
+	return PTR_ERR_OR_ZERO(kirin_pcie->sysctrl);
 }
 
 static int kirin_pcie_phy_init(struct kirin_pcie *kirin_pcie)

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

* [PATCH] PCI: fix ptr_ret.cocci warnings
  2018-07-11 23:30 drivers/pci/controller/pci-tegra.c:1132:1-3: WARNING: PTR_ERR_OR_ZERO can be used kbuild test robot
@ 2018-07-11 23:30 ` kbuild test robot
  2018-09-18 14:18   ` Lorenzo Pieralisi
  0 siblings, 1 reply; 10+ messages in thread
From: kbuild test robot @ 2018-07-11 23:30 UTC (permalink / raw)
  To: Shawn Lin
  Cc: kbuild-all, linux-kernel, Bjorn Helgaas, Thierry Reding,
	Lorenzo Pieralisi, Jonathan Hunter, linux-tegra, linux-pci

From: kbuild test robot <fengguang.wu@intel.com>

drivers/pci/controller/pci-tegra.c:1132:1-3: WARNING: PTR_ERR_OR_ZERO can be used


 Use PTR_ERR_OR_ZERO rather than if(IS_ERR(...)) + PTR_ERR

Generated by: scripts/coccinelle/api/ptr_ret.cocci

Fixes: 6e0832fa432e ("PCI: Collect all native drivers under drivers/pci/controller/")
CC: Shawn Lin <shawn.lin@rock-chips.com>
Signed-off-by: kbuild test robot <fengguang.wu@intel.com>
---

 pci-tegra.c |    5 +----
 1 file changed, 1 insertion(+), 4 deletions(-)

--- a/drivers/pci/controller/pci-tegra.c
+++ b/drivers/pci/controller/pci-tegra.c
@@ -1129,10 +1129,7 @@ static int tegra_pcie_resets_get(struct
 		return PTR_ERR(pcie->afi_rst);
 
 	pcie->pcie_xrst = devm_reset_control_get_exclusive(dev, "pcie_x");
-	if (IS_ERR(pcie->pcie_xrst))
-		return PTR_ERR(pcie->pcie_xrst);
-
-	return 0;
+	return PTR_ERR_OR_ZERO(pcie->pcie_xrst);
 }
 
 static int tegra_pcie_phys_get_legacy(struct tegra_pcie *pcie)

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

end of thread, other threads:[~2020-01-05  7:22 UTC | newest]

Thread overview: 10+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2019-12-27 12:18 drivers/pci/controller/pci-tegra.c:1365:1-3: WARNING: PTR_ERR_OR_ZERO can be used kbuild test robot
2019-12-27 12:18 ` [PATCH] PCI: fix ptr_ret.cocci warnings kbuild test robot
  -- strict thread matches above, loose matches on Subject: below --
2020-01-05  7:21 drivers/pci/controller/dwc/pci-exynos.c:95:1-3: WARNING: PTR_ERR_OR_ZERO can be used kbuild test robot
2020-01-05  7:21 ` [PATCH] PCI: fix ptr_ret.cocci warnings kbuild test robot
2018-07-19 23:42 drivers/pci/controller/dwc/pcie-kirin.c:141:1-3: WARNING: PTR_ERR_OR_ZERO can be used kbuild test robot
2018-07-19 23:42 ` [PATCH] PCI: fix ptr_ret.cocci warnings kbuild test robot
2018-09-18 14:21   ` Lorenzo Pieralisi
2018-09-19  0:40     ` Songxiaowei (Kirin_DRV)
2018-07-11 23:30 drivers/pci/controller/pci-tegra.c:1132:1-3: WARNING: PTR_ERR_OR_ZERO can be used kbuild test robot
2018-07-11 23:30 ` [PATCH] PCI: fix ptr_ret.cocci warnings kbuild test robot
2018-09-18 14:18   ` Lorenzo Pieralisi
2018-09-18 14:47     ` Thierry Reding
2018-09-18 16:30       ` Lorenzo Pieralisi

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).