From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from smtp.kernel.org (aws-us-west-2-korg-mail-1.web.codeaurora.org [10.30.226.201]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id E4CBA27453; Tue, 29 Apr 2025 17:14:32 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=10.30.226.201 ARC-Seal:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1745946873; cv=none; b=QtPSwf01BfyYvsGgH5Z/v3MmoGzKVMF4aKP/8ooR8AuHenKTXqVBwYAkNUf1jiUuS1/OBbp0WxbCdiBrwxx0QMC2IJc4h+xQZPRJyM8CdpM/7bZSPl+aAilm8hYOe9CEjEwyAnSAW52/J97NacNVonvMewQ/w1yuLzEJAfnRfKI= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1745946873; c=relaxed/simple; bh=aX/dIDn61So+RQ1oQSQb6mjwYt9hrKX5mTh6CQIAgmc=; h=From:To:Cc:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version:Content-Type; b=AF0hbMWdd43gUi+wfZmlJO0beILKbAiWBMBJDt8YqxqM1uDGC7QoZAzlX9uPG8SPw0iqZ/QaJKUBQQ1BczOZMUsexPDqfxGErtCyW1BVR53vE78WZ33i+JBoT/gQLgVCk3Y1I+jqjEpEmG2m/4dHAvl7Aubsf5+f2sJrN8lSllM= ARC-Authentication-Results:i=1; smtp.subspace.kernel.org; dkim=pass (1024-bit key) header.d=linuxfoundation.org header.i=@linuxfoundation.org header.b=SZdIdk+i; arc=none smtp.client-ip=10.30.226.201 Authentication-Results: smtp.subspace.kernel.org; dkim=pass (1024-bit key) header.d=linuxfoundation.org header.i=@linuxfoundation.org header.b="SZdIdk+i" Received: by smtp.kernel.org (Postfix) with ESMTPSA id 143F1C4CEE3; Tue, 29 Apr 2025 17:14:31 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1745946872; bh=aX/dIDn61So+RQ1oQSQb6mjwYt9hrKX5mTh6CQIAgmc=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=SZdIdk+iOXgXbOAoLY0gYw0eBKfSYBircHQyVSJ1jy3ODiWszv63jw6dSx2tvPAWJ xmkur6KaIRi4G4bENQq0GOL289b65POoTirM4lzHpu6ceVJ1Lvr7LAnqvZoyViixA8 2S5rfl9f2kNl2Wrb9DbhgG4+t3p4jgM/1zkjodl8= From: Greg Kroah-Hartman To: stable@vger.kernel.org Cc: Greg Kroah-Hartman , patches@lists.linux.dev, Stanimir Varbanov , Florian Fainelli , Manivannan Sadhasivam , =?UTF-8?q?Krzysztof=20Wilczy=C5=84ski?= Subject: [PATCH 5.10 095/286] PCI: brcmstb: Fix missing of_node_put() in brcm_pcie_probe() Date: Tue, 29 Apr 2025 18:39:59 +0200 Message-ID: <20250429161111.762024371@linuxfoundation.org> X-Mailer: git-send-email 2.49.0 In-Reply-To: <20250429161107.848008295@linuxfoundation.org> References: <20250429161107.848008295@linuxfoundation.org> User-Agent: quilt/0.68 X-stable: review X-Patchwork-Hint: ignore Precedence: bulk X-Mailing-List: patches@lists.linux.dev List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit 5.10-stable review patch. If anyone has any objections, please let me know. ------------------ From: Stanimir Varbanov commit 2df181e1aea4628a8fd257f866026625d0519627 upstream. A call to of_parse_phandle() is incrementing the refcount, and as such, the of_node_put() must be called when the reference is no longer needed. Thus, refactor the existing code and add a missing of_node_put() call following the check to ensure that "msi_np" matches "pcie->np" and after MSI initialization, but only if the MSI support is enabled system-wide. Cc: stable@vger.kernel.org # v5.10+ Fixes: 40ca1bf580ef ("PCI: brcmstb: Add MSI support") Signed-off-by: Stanimir Varbanov Reviewed-by: Florian Fainelli Reviewed-by: Manivannan Sadhasivam Link: https://lore.kernel.org/r/20250122222955.1752778-1-svarbanov@suse.de [kwilczynski: commit log] Signed-off-by: Krzysztof WilczyƄski Signed-off-by: Greg Kroah-Hartman --- drivers/pci/controller/pcie-brcmstb.c | 13 +++++++++---- 1 file changed, 9 insertions(+), 4 deletions(-) --- a/drivers/pci/controller/pcie-brcmstb.c +++ b/drivers/pci/controller/pcie-brcmstb.c @@ -1215,7 +1215,7 @@ static const struct of_device_id brcm_pc static int brcm_pcie_probe(struct platform_device *pdev) { - struct device_node *np = pdev->dev.of_node, *msi_np; + struct device_node *np = pdev->dev.of_node; struct pci_host_bridge *bridge; const struct pcie_cfg_data *data; struct brcm_pcie *pcie; @@ -1280,9 +1280,14 @@ static int brcm_pcie_probe(struct platfo pcie->hw_rev = readl(pcie->base + PCIE_MISC_REVISION); - msi_np = of_parse_phandle(pcie->np, "msi-parent", 0); - if (pci_msi_enabled() && msi_np == pcie->np) { - ret = brcm_pcie_enable_msi(pcie); + if (pci_msi_enabled()) { + struct device_node *msi_np = of_parse_phandle(pcie->np, "msi-parent", 0); + + if (msi_np == pcie->np) + ret = brcm_pcie_enable_msi(pcie); + + of_node_put(msi_np); + if (ret) { dev_err(pcie->dev, "probe of internal MSI failed"); goto fail;