linux-pci.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [pci:pci/host-designware 2/6] drivers/pci/dwc/pcie-qcom.c:215:1-3: WARNING: PTR_ERR_OR_ZERO can be used
@ 2017-02-04  1:35 kbuild test robot
  2017-02-04  1:35 ` [PATCH] PCI: dwc: fix ptr_ret.cocci warnings kbuild test robot
  0 siblings, 1 reply; 3+ messages in thread
From: kbuild test robot @ 2017-02-04  1:35 UTC (permalink / raw)
  To: Kishon Vijay Abraham I; +Cc: kbuild-all, linux-pci, Bjorn Helgaas, Pankaj Dubey

tree:   https://git.kernel.org/pub/scm/linux/kernel/git/helgaas/pci.git pci/host-designware
head:   ac4108c530acc8f1c964a8b1c04d4523d026fd29
commit: 2b5839db931bcc499fe85e843297f1518385780a [2/6] PCI: dwc: Add COMPILE_TEST to all DesignWare-based drivers


coccinelle warnings: (new ones prefixed by >>)

>> drivers/pci/dwc/pcie-qcom.c:215:1-3: WARNING: PTR_ERR_OR_ZERO can be used
   drivers/pci/dwc/pcie-qcom.c:247:1-3: WARNING: PTR_ERR_OR_ZERO can be used
   drivers/pci/dwc/pcie-qcom.c:481: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/pipermail/kbuild-all                   Intel Corporation

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

* [PATCH] PCI: dwc: fix ptr_ret.cocci warnings
  2017-02-04  1:35 [pci:pci/host-designware 2/6] drivers/pci/dwc/pcie-qcom.c:215:1-3: WARNING: PTR_ERR_OR_ZERO can be used kbuild test robot
@ 2017-02-04  1:35 ` kbuild test robot
  2017-02-07 23:03   ` Bjorn Helgaas
  0 siblings, 1 reply; 3+ messages in thread
From: kbuild test robot @ 2017-02-04  1:35 UTC (permalink / raw)
  To: Kishon Vijay Abraham I; +Cc: kbuild-all, linux-pci, Bjorn Helgaas, Pankaj Dubey

drivers/pci/dwc/pcie-qcom.c:215:1-3: WARNING: PTR_ERR_OR_ZERO can be used
drivers/pci/dwc/pcie-qcom.c:247:1-3: WARNING: PTR_ERR_OR_ZERO can be used
drivers/pci/dwc/pcie-qcom.c:481: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

CC: Kishon Vijay Abraham I <kishon@ti.com>
Signed-off-by: Fengguang Wu <fengguang.wu@intel.com>
---

 pcie-qcom.c |   15 +++------------
 1 file changed, 3 insertions(+), 12 deletions(-)

--- a/drivers/pci/dwc/pcie-qcom.c
+++ b/drivers/pci/dwc/pcie-qcom.c
@@ -212,10 +212,7 @@ static int qcom_pcie_get_resources_v0(st
 		return PTR_ERR(res->por_reset);
 
 	res->phy_reset = devm_reset_control_get(dev, "phy");
-	if (IS_ERR(res->phy_reset))
-		return PTR_ERR(res->phy_reset);
-
-	return 0;
+	return PTR_ERR_OR_ZERO(res->phy_reset);
 }
 
 static int qcom_pcie_get_resources_v1(struct qcom_pcie *pcie)
@@ -244,10 +241,7 @@ static int qcom_pcie_get_resources_v1(st
 		return PTR_ERR(res->slave_bus);
 
 	res->core = devm_reset_control_get(dev, "core");
-	if (IS_ERR(res->core))
-		return PTR_ERR(res->core);
-
-	return 0;
+	return PTR_ERR_OR_ZERO(res->core);
 }
 
 static void qcom_pcie_deinit_v0(struct qcom_pcie *pcie)
@@ -478,10 +472,7 @@ static int qcom_pcie_get_resources_v2(st
 		return PTR_ERR(res->slave_clk);
 
 	res->pipe_clk = devm_clk_get(dev, "pipe");
-	if (IS_ERR(res->pipe_clk))
-		return PTR_ERR(res->pipe_clk);
-
-	return 0;
+	return PTR_ERR_OR_ZERO(res->pipe_clk);
 }
 
 static int qcom_pcie_init_v2(struct qcom_pcie *pcie)

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

* Re: [PATCH] PCI: dwc: fix ptr_ret.cocci warnings
  2017-02-04  1:35 ` [PATCH] PCI: dwc: fix ptr_ret.cocci warnings kbuild test robot
@ 2017-02-07 23:03   ` Bjorn Helgaas
  0 siblings, 0 replies; 3+ messages in thread
From: Bjorn Helgaas @ 2017-02-07 23:03 UTC (permalink / raw)
  To: kbuild test robot
  Cc: Kishon Vijay Abraham I, kbuild-all, linux-pci, Bjorn Helgaas,
	Pankaj Dubey

On Sat, Feb 04, 2017 at 09:35:32AM +0800, kbuild test robot wrote:
> drivers/pci/dwc/pcie-qcom.c:215:1-3: WARNING: PTR_ERR_OR_ZERO can be used
> drivers/pci/dwc/pcie-qcom.c:247:1-3: WARNING: PTR_ERR_OR_ZERO can be used
> drivers/pci/dwc/pcie-qcom.c:481: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
> 
> CC: Kishon Vijay Abraham I <kishon@ti.com>
> Signed-off-by: Fengguang Wu <fengguang.wu@intel.com>

Applied to pci/host-designware for v4.11, thanks!

> ---
> 
>  pcie-qcom.c |   15 +++------------
>  1 file changed, 3 insertions(+), 12 deletions(-)
> 
> --- a/drivers/pci/dwc/pcie-qcom.c
> +++ b/drivers/pci/dwc/pcie-qcom.c
> @@ -212,10 +212,7 @@ static int qcom_pcie_get_resources_v0(st
>  		return PTR_ERR(res->por_reset);
>  
>  	res->phy_reset = devm_reset_control_get(dev, "phy");
> -	if (IS_ERR(res->phy_reset))
> -		return PTR_ERR(res->phy_reset);
> -
> -	return 0;
> +	return PTR_ERR_OR_ZERO(res->phy_reset);
>  }
>  
>  static int qcom_pcie_get_resources_v1(struct qcom_pcie *pcie)
> @@ -244,10 +241,7 @@ static int qcom_pcie_get_resources_v1(st
>  		return PTR_ERR(res->slave_bus);
>  
>  	res->core = devm_reset_control_get(dev, "core");
> -	if (IS_ERR(res->core))
> -		return PTR_ERR(res->core);
> -
> -	return 0;
> +	return PTR_ERR_OR_ZERO(res->core);
>  }
>  
>  static void qcom_pcie_deinit_v0(struct qcom_pcie *pcie)
> @@ -478,10 +472,7 @@ static int qcom_pcie_get_resources_v2(st
>  		return PTR_ERR(res->slave_clk);
>  
>  	res->pipe_clk = devm_clk_get(dev, "pipe");
> -	if (IS_ERR(res->pipe_clk))
> -		return PTR_ERR(res->pipe_clk);
> -
> -	return 0;
> +	return PTR_ERR_OR_ZERO(res->pipe_clk);
>  }
>  
>  static int qcom_pcie_init_v2(struct qcom_pcie *pcie)

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

end of thread, other threads:[~2017-02-07 23:14 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2017-02-04  1:35 [pci:pci/host-designware 2/6] drivers/pci/dwc/pcie-qcom.c:215:1-3: WARNING: PTR_ERR_OR_ZERO can be used kbuild test robot
2017-02-04  1:35 ` [PATCH] PCI: dwc: fix ptr_ret.cocci warnings kbuild test robot
2017-02-07 23:03   ` Bjorn Helgaas

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).