linux-pci.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: kbuild test robot <fengguang.wu@intel.com>
To: Kishon Vijay Abraham I <kishon@ti.com>
Cc: kbuild-all@01.org, linux-pci@vger.kernel.org,
	Bjorn Helgaas <bhelgaas@google.com>,
	Pankaj Dubey <pankaj.dubey@samsung.com>
Subject: [PATCH] PCI: dwc: fix ptr_ret.cocci warnings
Date: Sat, 4 Feb 2017 09:35:32 +0800	[thread overview]
Message-ID: <20170204013531.GA26132@lkp-wsm-ep2> (raw)
In-Reply-To: <201702040917.XTwXdmmt%fengguang.wu@intel.com>

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)

  reply	other threads:[~2017-02-04  1:36 UTC|newest]

Thread overview: 3+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
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 [this message]
2017-02-07 23:03   ` [PATCH] PCI: dwc: fix ptr_ret.cocci warnings Bjorn Helgaas

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20170204013531.GA26132@lkp-wsm-ep2 \
    --to=fengguang.wu@intel.com \
    --cc=bhelgaas@google.com \
    --cc=kbuild-all@01.org \
    --cc=kishon@ti.com \
    --cc=linux-pci@vger.kernel.org \
    --cc=pankaj.dubey@samsung.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
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).