linux-pci.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Fabio Estevam <festevam@gmail.com>
To: bhelgaas@google.com
Cc: jingoohan1@gmail.com, lorenzo.pieralisi@arm.com, robh@kernel.org,
	linux-pci@vger.kernel.org, Fabio Estevam <festevam@gmail.com>,
	Bjorn Helgaas <helgaas@kernel.org>
Subject: [PATCH] PCI: dwc: exynos: Check the phy_power_on() return value
Date: Mon,  8 Feb 2021 14:41:14 -0300	[thread overview]
Message-ID: <20210208174114.615811-1-festevam@gmail.com> (raw)

phy_power_on() may fail, so we should better check its return
value and propagate it in the error case.

This fixes the following Coverity error:

	CID 1472841:  Error handling issues  (CHECKED_RETURN)
	Calling "phy_power_on" without checking return value (as is done elsewhere 40 out of 50 times).
	phy_power_on(ep->phy);
	phy_init(ep->phy);
           
Reported-by: Bjorn Helgaas <helgaas@kernel.org>
Signed-off-by: Fabio Estevam <festevam@gmail.com>
---
 drivers/pci/controller/dwc/pci-exynos.c | 6 +++++-
 1 file changed, 5 insertions(+), 1 deletion(-)

diff --git a/drivers/pci/controller/dwc/pci-exynos.c b/drivers/pci/controller/dwc/pci-exynos.c
index c24dab383654..eabedc0529cb 100644
--- a/drivers/pci/controller/dwc/pci-exynos.c
+++ b/drivers/pci/controller/dwc/pci-exynos.c
@@ -254,13 +254,17 @@ static int exynos_pcie_host_init(struct pcie_port *pp)
 {
 	struct dw_pcie *pci = to_dw_pcie_from_pp(pp);
 	struct exynos_pcie *ep = to_exynos_pcie(pci);
+	int ret;
 
 	pp->bridge->ops = &exynos_pci_ops;
 
 	exynos_pcie_assert_core_reset(ep);
 
 	phy_reset(ep->phy);
-	phy_power_on(ep->phy);
+	ret = phy_power_on(ep->phy);
+	if (ret < 0)
+		return ret;
+
 	phy_init(ep->phy);
 
 	exynos_pcie_deassert_core_reset(ep);
-- 
2.25.1


             reply	other threads:[~2021-02-08 17:44 UTC|newest]

Thread overview: 5+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2021-02-08 17:41 Fabio Estevam [this message]
2021-02-23 21:17 ` [PATCH] PCI: dwc: exynos: Check the phy_power_on() return value Krzysztof Wilczyński
2021-03-23 11:10   ` Lorenzo Pieralisi
2021-03-23 11:33     ` Fabio Estevam
2021-03-23 11:49       ` Lorenzo Pieralisi

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=20210208174114.615811-1-festevam@gmail.com \
    --to=festevam@gmail.com \
    --cc=bhelgaas@google.com \
    --cc=helgaas@kernel.org \
    --cc=jingoohan1@gmail.com \
    --cc=linux-pci@vger.kernel.org \
    --cc=lorenzo.pieralisi@arm.com \
    --cc=robh@kernel.org \
    /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).