linux-pci.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Geert Uytterhoeven <geert+renesas@glider.be>
To: Simon Horman <horms@verge.net.au>,
	Lorenzo Pieralisi <lorenzo.pieralisi@arm.com>,
	Bjorn Helgaas <bhelgaas@google.com>
Cc: Harunobu Kurokawa <harunobu.kurokawa.dn@renesas.com>,
	Phil Edworthy <phil.edworthy@renesas.com>,
	linux-pci@vger.kernel.org, linux-renesas-soc@vger.kernel.org,
	linux-kernel@vger.kernel.org,
	Geert Uytterhoeven <geert+renesas@glider.be>
Subject: [PATCH 2/2] PCI: rcar: Handle rcar_pcie_parse_request_of_pci_ranges() failures
Date: Thu,  7 Dec 2017 11:15:20 +0100	[thread overview]
Message-ID: <1512641720-4715-3-git-send-email-geert+renesas@glider.be> (raw)
In-Reply-To: <1512641720-4715-1-git-send-email-geert+renesas@glider.be>

rcar_pcie_parse_request_of_pci_ranges() can fail and return an error
code, but this is not checked nor handled.

Fix this by adding the missing error handling.

Fixes: 5d2917d469faab72 ("PCI: rcar: Convert to DT resource parsing API")
Signed-off-by: Geert Uytterhoeven <geert+renesas@glider.be>
---
 drivers/pci/host/pcie-rcar.c | 5 ++++-
 1 file changed, 4 insertions(+), 1 deletion(-)

diff --git a/drivers/pci/host/pcie-rcar.c b/drivers/pci/host/pcie-rcar.c
index 52ab3cb0a0bfe065..95ca4a1feba4b759 100644
--- a/drivers/pci/host/pcie-rcar.c
+++ b/drivers/pci/host/pcie-rcar.c
@@ -1123,7 +1123,9 @@ static int rcar_pcie_probe(struct platform_device *pdev)
 
 	INIT_LIST_HEAD(&pcie->resources);
 
-	rcar_pcie_parse_request_of_pci_ranges(pcie);
+	err = rcar_pcie_parse_request_of_pci_ranges(pcie);
+	if (err)
+		goto err_free_bridge;
 
 	err = rcar_pcie_get_resources(pcie);
 	if (err < 0) {
@@ -1178,6 +1180,7 @@ static int rcar_pcie_probe(struct platform_device *pdev)
 
 err_free_resource_list:
 	pci_free_resource_list(&pcie->resources);
+err_free_bridge:
 	pci_free_host_bridge(bridge);
 
 	return err;
-- 
2.7.4

  parent reply	other threads:[~2017-12-07 10:15 UTC|newest]

Thread overview: 12+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2017-12-07 10:15 [PATCH 0/2] PCI: rcar: Misc error path fixes Geert Uytterhoeven
2017-12-07 10:15 ` [PATCH 1/2] PCI: rcar: Fix use-after-free in probe error path Geert Uytterhoeven
2017-12-08 10:24   ` Lorenzo Pieralisi
2017-12-12 19:29   ` Bjorn Helgaas
2017-12-13  8:29     ` Simon Horman
2017-12-07 10:15 ` Geert Uytterhoeven [this message]
2017-12-08 10:30   ` [PATCH 2/2] PCI: rcar: Handle rcar_pcie_parse_request_of_pci_ranges() failures Lorenzo Pieralisi
2017-12-19 11:40   ` Lorenzo Pieralisi
2017-12-07 10:29 ` [PATCH 0/2] PCI: rcar: Misc error path fixes Simon Horman
2017-12-12 17:16 ` Bjorn Helgaas
2017-12-12 18:07   ` Geert Uytterhoeven
2017-12-12 18:10   ` 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=1512641720-4715-3-git-send-email-geert+renesas@glider.be \
    --to=geert+renesas@glider.be \
    --cc=bhelgaas@google.com \
    --cc=harunobu.kurokawa.dn@renesas.com \
    --cc=horms@verge.net.au \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-pci@vger.kernel.org \
    --cc=linux-renesas-soc@vger.kernel.org \
    --cc=lorenzo.pieralisi@arm.com \
    --cc=phil.edworthy@renesas.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).