Received: by 2002:a05:6a10:af89:0:0:0:0 with SMTP id iu9csp3724443pxb; Mon, 24 Jan 2022 16:23:24 -0800 (PST) X-Google-Smtp-Source: ABdhPJzfAmaKkj0312Tz/KCKEghQqTK2hwplo9WmX5iPJtbG92e2cBxe7E/TXFIkOVc9cIpUcCZo X-Received: by 2002:a17:902:8b8c:b0:149:faad:2d1 with SMTP id ay12-20020a1709028b8c00b00149faad02d1mr16735509plb.141.1643070203980; Mon, 24 Jan 2022 16:23:23 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1643070203; cv=none; d=google.com; s=arc-20160816; b=UnJfJGqTgSwlvEEbzVnB6z/gTxvZ/jRRUPTaZcnpsUhdSnB83xpjXybbmNlvAZ/Wnl 8MFczk5jip7QvFqAdPzDvkVQoXogi/fffP8z8xw1xOF0vySn3DeXYLoJskfD/zab2GU2 daxgl/lrzJ2FbGU79xsClpG2ANBI7RTFitsuir+1ei2QFL0Gv0mK6/Xe9AzlfqjN1+UY /Ak6UqOejyI/akVowkowAcyzNSkLlXYf/rGGfUtyRNHPclCUi3CQOYw+4LvieuUEylCl ldnvfSOXTJF9daiy9ydu0SVoaqWuegPwvYGVYvM9fSCQ4fA9/S1rb2AP6cu6caonnT5z x+/g== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:mime-version :user-agent:references:in-reply-to:message-id:date:subject:cc:to :from:dkim-signature; bh=fBMi3iv6GXu5d4SaSC2u4qPi0jACx6qjYfHO+oBOAyg=; b=pKKnNCMNOpULZ+28EF6jhREEdyIN1lZ7wJXS8NLNLFVLaD04VuzOulbhMq0wxyamuo e0OPZeW+/QdA+RKcHE47loTGdTRW8IPZCo83DMBeR9j209oaQSrPmZX/poqaJXRJu9yF d22HEKthpPmt59vx8ErjwmCuUNuV17ISXnF+UO8JowAnuS684xWv0eQqF2Qjuy5kN75c NrBaxcj/2QSRmmXDPwftNFT3XSdUVhVNYrgBM1Egt6oy0abKyHA8BsI/3lSaR9VlKy8d 1usTwUAszd47++ElhsIyNQOpYhk2d9oP0vEb7T57vr0nzw8Ze2TMa95gqoDMAEhRCncR VwAw== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linuxfoundation.org header.s=korg header.b="Z/ZMPbkK"; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linuxfoundation.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id h3si11105039pfr.18.2022.01.24.16.23.12; Mon, 24 Jan 2022 16:23:23 -0800 (PST) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) client-ip=23.128.96.18; Authentication-Results: mx.google.com; dkim=pass header.i=@linuxfoundation.org header.s=korg header.b="Z/ZMPbkK"; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linuxfoundation.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S2374407AbiAYAQ6 (ORCPT + 99 others); Mon, 24 Jan 2022 19:16:58 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:53370 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1850496AbiAXXaH (ORCPT ); Mon, 24 Jan 2022 18:30:07 -0500 Received: from dfw.source.kernel.org (dfw.source.kernel.org [IPv6:2604:1380:4641:c500::1]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id CA355C0A8930; Mon, 24 Jan 2022 13:34:40 -0800 (PST) Received: from smtp.kernel.org (relay.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by dfw.source.kernel.org (Postfix) with ESMTPS id 6A87161469; Mon, 24 Jan 2022 21:34:40 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 52050C340E4; Mon, 24 Jan 2022 21:34:39 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1643060079; bh=sLfxwkR7xnnWAPCDwvtlM2q9dCEaGfOBaWsBhM/oKzE=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=Z/ZMPbkKVltW7skwetVaT8o69LuL85zcQGUZ16S77OMIwfzxDGsI09O0iG/jnwTea pxYS85YfdRDERp0d7yBRPkv0ggSop67vtJap0qcWGzOuYXX+ixJxtpPYW3bTFHHMv/ JqAZkQlE4ar4OVEccRQLR4wUW4aqN0T6ULj5MsmQ= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, =?UTF-8?q?Pali=20Roh=C3=A1r?= , Lorenzo Pieralisi , Sasha Levin Subject: [PATCH 5.16 0799/1039] PCI: mvebu: Check for errors from pci_bridge_emul_init() call Date: Mon, 24 Jan 2022 19:43:08 +0100 Message-Id: <20220124184152.158416216@linuxfoundation.org> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20220124184125.121143506@linuxfoundation.org> References: <20220124184125.121143506@linuxfoundation.org> User-Agent: quilt/0.66 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org From: Pali Rohár [ Upstream commit 5d18d702e5c9309f4195653475c7a7fdde4ca71f ] Function pci_bridge_emul_init() may fail so correctly check for errors. Link: https://lore.kernel.org/r/20211125124605.25915-3-pali@kernel.org Fixes: 1f08673eef12 ("PCI: mvebu: Convert to PCI emulated bridge config space") Signed-off-by: Pali Rohár Signed-off-by: Lorenzo Pieralisi Signed-off-by: Sasha Levin --- drivers/pci/controller/pci-mvebu.c | 15 ++++++++++++--- 1 file changed, 12 insertions(+), 3 deletions(-) diff --git a/drivers/pci/controller/pci-mvebu.c b/drivers/pci/controller/pci-mvebu.c index ed13e81cd691d..e6d63ad4d23b8 100644 --- a/drivers/pci/controller/pci-mvebu.c +++ b/drivers/pci/controller/pci-mvebu.c @@ -570,7 +570,7 @@ static struct pci_bridge_emul_ops mvebu_pci_bridge_emul_ops = { * Initialize the configuration space of the PCI-to-PCI bridge * associated with the given PCIe interface. */ -static void mvebu_pci_bridge_emul_init(struct mvebu_pcie_port *port) +static int mvebu_pci_bridge_emul_init(struct mvebu_pcie_port *port) { struct pci_bridge_emul *bridge = &port->bridge; @@ -589,7 +589,7 @@ static void mvebu_pci_bridge_emul_init(struct mvebu_pcie_port *port) bridge->data = port; bridge->ops = &mvebu_pci_bridge_emul_ops; - pci_bridge_emul_init(bridge, PCI_BRIDGE_EMUL_NO_PREFETCHABLE_BAR); + return pci_bridge_emul_init(bridge, PCI_BRIDGE_EMUL_NO_PREFETCHABLE_BAR); } static inline struct mvebu_pcie *sys_to_pcie(struct pci_sys_data *sys) @@ -1112,9 +1112,18 @@ static int mvebu_pcie_probe(struct platform_device *pdev) continue; } + ret = mvebu_pci_bridge_emul_init(port); + if (ret < 0) { + dev_err(dev, "%s: cannot init emulated bridge\n", + port->name); + devm_iounmap(dev, port->base); + port->base = NULL; + mvebu_pcie_powerdown(port); + continue; + } + mvebu_pcie_setup_hw(port); mvebu_pcie_set_local_dev_nr(port, 1); - mvebu_pci_bridge_emul_init(port); } pcie->nports = i; -- 2.34.1