From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from mail-sn1nam01on0106.outbound.protection.outlook.com ([104.47.32.106]:14491 "EHLO NAM01-SN1-obe.outbound.protection.outlook.com" rhost-flags-OK-OK-OK-FAIL) by vger.kernel.org with ESMTP id S965311AbeCHE7J (ORCPT ); Wed, 7 Mar 2018 23:59:09 -0500 From: Sasha Levin To: "linux-kernel@vger.kernel.org" , "stable@vger.kernel.org" CC: Geert Uytterhoeven , Lorenzo Pieralisi , Sasha Levin Subject: [PATCH AUTOSEL for 4.14 48/67] PCI: rcar: Handle rcar_pcie_parse_request_of_pci_ranges() failures Date: Thu, 8 Mar 2018 04:57:52 +0000 Message-ID: <20180308045641.7814-48-alexander.levin@microsoft.com> References: <20180308045641.7814-1-alexander.levin@microsoft.com> In-Reply-To: <20180308045641.7814-1-alexander.levin@microsoft.com> Content-Language: en-US Content-Type: text/plain; charset="iso-8859-1" Content-Transfer-Encoding: quoted-printable MIME-Version: 1.0 Sender: stable-owner@vger.kernel.org List-ID: From: Geert Uytterhoeven [ Upstream commit 83c75ddd816e979802bd244ad494139f28152921 ] 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 Signed-off-by: Lorenzo Pieralisi Signed-off-by: Sasha Levin --- 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 f09ff4789bb5..8f44a7d14bff 100644 --- a/drivers/pci/host/pcie-rcar.c +++ b/drivers/pci/host/pcie-rcar.c @@ -1141,7 +1141,9 @@ static int rcar_pcie_probe(struct platform_device *pd= ev) =20 INIT_LIST_HEAD(&pcie->resources); =20 - rcar_pcie_parse_request_of_pci_ranges(pcie); + err =3D rcar_pcie_parse_request_of_pci_ranges(pcie); + if (err) + goto err_free_bridge; =20 err =3D rcar_pcie_get_resources(pcie); if (err < 0) { @@ -1196,6 +1198,7 @@ static int rcar_pcie_probe(struct platform_device *pd= ev) =20 err_free_resource_list: pci_free_resource_list(&pcie->resources); +err_free_bridge: pci_free_host_bridge(bridge); =20 return err; --=20 2.14.1