From patchwork Wed Feb 27 04:40:36 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Wen Yang X-Patchwork-Id: 10831071 Return-Path: Received: from mail.wl.linuxfoundation.org (pdx-wl-mail.web.codeaurora.org [172.30.200.125]) by pdx-korg-patchwork-2.web.codeaurora.org (Postfix) with ESMTP id A406E1880 for ; Wed, 27 Feb 2019 04:41:21 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 8C0BA2D31B for ; Wed, 27 Feb 2019 04:41:21 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id 7FB222D32E; Wed, 27 Feb 2019 04:41:21 +0000 (UTC) X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on pdx-wl-mail.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-5.2 required=2.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,MAILING_LIST_MULTI,RCVD_IN_DNSWL_MED autolearn=ham version=3.3.1 Received: from bombadil.infradead.org (bombadil.infradead.org [198.137.202.133]) (using TLSv1.2 with cipher AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.wl.linuxfoundation.org (Postfix) with ESMTPS id 17F282D31B for ; Wed, 27 Feb 2019 04:41:21 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=lists.infradead.org; s=bombadil.20170209; h=Sender: Content-Transfer-Encoding:Content-Type:MIME-Version:Cc:List-Subscribe: List-Help:List-Post:List-Archive:List-Unsubscribe:List-Id:Message-Id:Date: Subject:To:From:Reply-To:Content-ID:Content-Description:Resent-Date: Resent-From:Resent-Sender:Resent-To:Resent-Cc:Resent-Message-ID:In-Reply-To: References:List-Owner; bh=PPrVxNKzPXU16m0GCtTYexiTskZkRRUUi0gdqWakcFY=; b=MSh EFb/mhiUzUt8mrOZDX23+Ja/9ZvEqm7fKIhd4k4F9Ym1uo3VQ93HsGKZMSmnzz4TtIbTtX7Cd/uUe YtambyiNySyYAEWe96JkadUCArMMUBegwv7Ix+eBpS4UhS9QIMsQxmdG1F+beYaeVtHKhyIf2ewr4 3ykKiRzGP9UBPlbk6N+ZvVVEfvvdvCXrIg0uiJEykzwoDnsPG3qlkKgos6VBDIo+x6Y14saibxlNS 8UXIV2dbDBBFCV6zjkfQRb2L8sOLM4JitsFSFYFmRrIOncZqH52OjXOcVRXvZLPk1hlehKPOijxEt Zs9O6DWk2k91mnk6L78W3MCufvEoZTg==; Received: from localhost ([127.0.0.1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.90_1 #2 (Red Hat Linux)) id 1gyr1w-0005Kq-M9; Wed, 27 Feb 2019 04:41:16 +0000 Received: from mxhk.zte.com.cn ([63.217.80.70]) by bombadil.infradead.org with esmtps (Exim 4.90_1 #2 (Red Hat Linux)) id 1gyr1W-0004lL-TK; Wed, 27 Feb 2019 04:40:52 +0000 Received: from mse01.zte.com.cn (unknown [10.30.3.20]) by Forcepoint Email with ESMTPS id CEF291E758D9ADE3065E; Wed, 27 Feb 2019 12:40:38 +0800 (CST) Received: from notes_smtp.zte.com.cn ([10.30.1.239]) by mse01.zte.com.cn with ESMTP id x1R4eWI3003595; Wed, 27 Feb 2019 12:40:32 +0800 (GMT-8) (envelope-from wen.yang99@zte.com.cn) Received: from fox-host8.localdomain ([10.74.120.8]) by szsmtp06.zte.com.cn (Lotus Domino Release 8.5.3FP6) with ESMTP id 2019022712405358-2029105 ; Wed, 27 Feb 2019 12:40:53 +0800 From: Wen Yang To: benh@kernel.crashing.org Subject: [PATCH 1/8] PCI: dwc: pci-dra7xx: fix a leaked reference by adding missing of_node_put Date: Wed, 27 Feb 2019 12:40:36 +0800 Message-Id: <1551242443-27300-1-git-send-email-wen.yang99@zte.com.cn> X-Mailer: git-send-email 1.8.3.1 X-MIMETrack: Itemize by SMTP Server on SZSMTP06/server/zte_ltd(Release 8.5.3FP6|November 21, 2013) at 2019-02-27 12:40:53, Serialize by Router on notes_smtp/zte_ltd(Release 9.0.1FP7|August 17, 2016) at 2019-02-27 12:40:25, Serialize complete at 2019-02-27 12:40:25 X-MAIL: mse01.zte.com.cn x1R4eWI3003595 X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20190226_204051_103111_12271120 X-CRM114-Status: GOOD ( 10.72 ) X-BeenThere: linux-rockchip@lists.infradead.org X-Mailman-Version: 2.1.21 Precedence: list List-Id: Upstream kernel work for Rockchip platforms List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: heiko@sntech.de, hayashi.kunihiko@socionext.com, linux-pci@vger.kernel.org, shawn.lin@rock-chips.com, minghuan.Lian@nxp.com, paulus@samba.org, thomas.petazzoni@bootlin.com, Wen Yang , ryder.lee@mediatek.com, mpe@ellerman.id.au, kishon@ti.com, linux-rockchip@lists.infradead.org, bcm-kernel-feedback-list@broadcom.com, linux-arm-kernel@lists.infradead.org, wang.yi59@zte.com.cn, rjui@broadcom.com, lorenzo.pieralisi@arm.com, linux-mediatek@lists.infradead.org, tyreld@linux.vnet.ibm.com, matthias.bgg@gmail.com, linux-omap@vger.kernel.org, mingkai.hu@nxp.com, roy.zang@nxp.com, sbranden@broadcom.com, yamada.masahiro@socionext.com, linuxppc-dev@lists.ozlabs.org, linux-kernel@vger.kernel.org, bhelgaas@google.com MIME-Version: 1.0 Sender: "Linux-rockchip" Errors-To: linux-rockchip-bounces+patchwork-linux-rockchip=patchwork.kernel.org@lists.infradead.org X-Virus-Scanned: ClamAV using ClamSMTP The call to of_get_next_child returns a node pointer with refcount incremented thus it must be explicitly decremented after the last usage. irq_domain_add_linear also calls of_node_get to increase refcount, so irq_domain will not be affected when it is released. Detected by coccinelle with the following warnings: ./drivers/pci/controller/dwc/pci-dra7xx.c:252:2-8: ERROR: missing of_node_put; acquired a node pointer with refcount incremented on line 241, but without a corresponding object release within this function. ./drivers/pci/controller/dwc/pci-dra7xx.c:255:1-7: ERROR: missing of_node_put; acquired a node pointer with refcount incremented on line 241, but without a corresponding object release within this function. Signed-off-by: Wen Yang Cc: Kishon Vijay Abraham I Cc: Lorenzo Pieralisi Cc: Bjorn Helgaas Cc: linux-omap@vger.kernel.org Cc: linux-pci@vger.kernel.org Cc: linux-kernel@vger.kernel.org --- drivers/pci/controller/dwc/pci-dra7xx.c | 1 + 1 file changed, 1 insertion(+) diff --git a/drivers/pci/controller/dwc/pci-dra7xx.c b/drivers/pci/controller/dwc/pci-dra7xx.c index ae84a69..627c91d 100644 --- a/drivers/pci/controller/dwc/pci-dra7xx.c +++ b/drivers/pci/controller/dwc/pci-dra7xx.c @@ -247,6 +247,7 @@ static int dra7xx_pcie_init_irq_domain(struct pcie_port *pp) dra7xx->irq_domain = irq_domain_add_linear(pcie_intc_node, PCI_NUM_INTX, &intx_domain_ops, pp); + of_node_put(pcie_intc_node); if (!dra7xx->irq_domain) { dev_err(dev, "Failed to get a INTx IRQ domain\n"); return -ENODEV; From patchwork Wed Feb 27 04:40:37 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Wen Yang X-Patchwork-Id: 10831069 Return-Path: Received: from mail.wl.linuxfoundation.org (pdx-wl-mail.web.codeaurora.org [172.30.200.125]) by pdx-korg-patchwork-2.web.codeaurora.org (Postfix) with ESMTP id 5E8D1922 for ; Wed, 27 Feb 2019 04:41:21 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 485E32D316 for ; Wed, 27 Feb 2019 04:41:21 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id 3BBE72D32E; Wed, 27 Feb 2019 04:41:21 +0000 (UTC) X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on pdx-wl-mail.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-5.2 required=2.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,MAILING_LIST_MULTI,RCVD_IN_DNSWL_MED autolearn=unavailable version=3.3.1 Received: from bombadil.infradead.org (bombadil.infradead.org [198.137.202.133]) (using TLSv1.2 with cipher AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.wl.linuxfoundation.org (Postfix) with ESMTPS id DB1B92D316 for ; Wed, 27 Feb 2019 04:41:20 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=lists.infradead.org; s=bombadil.20170209; h=Sender: Content-Transfer-Encoding:Content-Type:MIME-Version:Cc:List-Subscribe: List-Help:List-Post:List-Archive:List-Unsubscribe:List-Id:References: In-Reply-To:Message-Id:Date:Subject:To:From:Reply-To:Content-ID: Content-Description:Resent-Date:Resent-From:Resent-Sender:Resent-To:Resent-Cc :Resent-Message-ID:List-Owner; bh=hDTKw9jSe7P7yYsEwCPCVPRMIwC1pA4otOOUn8YmAIw=; b=m05VmiRiEW/LZJXMoOIhn1DkO8 Aow6zg0V82rgNmwejXb/yvxRPadaDca52i2+nJA+HsIQV4QjIzWw0HFh4UrYeYf2UARd3XhbXAIZB zeUko0exEF8olc8Nl0TdNrVRXRug9xRwPA9EgO3ZBTrP2zE0GOl4wA1aGMzIZhO/uqzijkbuOmbBp GVL313vdXeXaz948/nsN2cohlMxWJ333al8SnnEwnbqrmQN8dMcGvFBRnNzbFYo7jYKaKK3osu2iu qhWiDJXPklNglFrgoQ7qxY11/5uxmg4T6fm2GL5aWb6XTJu45/zmRi/dpbaOKdz4Qtpv15mkyV5Iv ejiITvbg==; Received: from localhost ([127.0.0.1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.90_1 #2 (Red Hat Linux)) id 1gyr1y-0005Mg-31; Wed, 27 Feb 2019 04:41:18 +0000 Received: from out1.zte.com.cn ([202.103.147.172] helo=mxct.zte.com.cn) by bombadil.infradead.org with esmtps (Exim 4.90_1 #2 (Red Hat Linux)) id 1gyr1W-0004lM-TL; Wed, 27 Feb 2019 04:40:53 +0000 Received: from mse01.zte.com.cn (unknown [10.30.3.20]) by Forcepoint Email with ESMTPS id 7D76CE85EDBE605184E3; Wed, 27 Feb 2019 12:40:42 +0800 (CST) Received: from notes_smtp.zte.com.cn ([10.30.1.239]) by mse01.zte.com.cn with ESMTP id x1R4eaTr003644; Wed, 27 Feb 2019 12:40:36 +0800 (GMT-8) (envelope-from wen.yang99@zte.com.cn) Received: from fox-host8.localdomain ([10.74.120.8]) by szsmtp06.zte.com.cn (Lotus Domino Release 8.5.3FP6) with ESMTP id 2019022712405722-2029107 ; Wed, 27 Feb 2019 12:40:57 +0800 From: Wen Yang To: benh@kernel.crashing.org Subject: [PATCH 2/8] PCI: uniphier: fix a leaked reference by adding missing of_node_put Date: Wed, 27 Feb 2019 12:40:37 +0800 Message-Id: <1551242443-27300-2-git-send-email-wen.yang99@zte.com.cn> X-Mailer: git-send-email 1.8.3.1 In-Reply-To: <1551242443-27300-1-git-send-email-wen.yang99@zte.com.cn> References: <1551242443-27300-1-git-send-email-wen.yang99@zte.com.cn> X-MIMETrack: Itemize by SMTP Server on SZSMTP06/server/zte_ltd(Release 8.5.3FP6|November 21, 2013) at 2019-02-27 12:40:57, Serialize by Router on notes_smtp/zte_ltd(Release 9.0.1FP7|August 17, 2016) at 2019-02-27 12:40:29, Serialize complete at 2019-02-27 12:40:29 X-MAIL: mse01.zte.com.cn x1R4eaTr003644 X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20190226_204051_103292_638DDA1E X-CRM114-Status: GOOD ( 12.87 ) X-BeenThere: linux-rockchip@lists.infradead.org X-Mailman-Version: 2.1.21 Precedence: list List-Id: Upstream kernel work for Rockchip platforms List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: heiko@sntech.de, hayashi.kunihiko@socionext.com, linux-pci@vger.kernel.org, shawn.lin@rock-chips.com, minghuan.Lian@nxp.com, paulus@samba.org, thomas.petazzoni@bootlin.com, Wen Yang , ryder.lee@mediatek.com, mpe@ellerman.id.au, kishon@ti.com, linux-rockchip@lists.infradead.org, bcm-kernel-feedback-list@broadcom.com, linux-arm-kernel@lists.infradead.org, wang.yi59@zte.com.cn, rjui@broadcom.com, lorenzo.pieralisi@arm.com, linux-mediatek@lists.infradead.org, tyreld@linux.vnet.ibm.com, matthias.bgg@gmail.com, linux-omap@vger.kernel.org, mingkai.hu@nxp.com, roy.zang@nxp.com, sbranden@broadcom.com, yamada.masahiro@socionext.com, linuxppc-dev@lists.ozlabs.org, linux-kernel@vger.kernel.org, bhelgaas@google.com MIME-Version: 1.0 Sender: "Linux-rockchip" Errors-To: linux-rockchip-bounces+patchwork-linux-rockchip=patchwork.kernel.org@lists.infradead.org X-Virus-Scanned: ClamAV using ClamSMTP The call to of_get_child_by_name returns a node pointer with refcount incremented thus it must be explicitly decremented after the last usage. irq_domain_add_linear also calls of_node_get to increase refcount, so irq_domain will not be affected when it is released. Detected by coccinelle with the following warnings: ./drivers/pci/controller/dwc/pcie-uniphier.c:283:2-8: ERROR: missing of_node_put; acquired a node pointer with refcount incremented on line 274, but without a corresponding object release within this function. ./drivers/pci/controller/dwc/pcie-uniphier.c:290:2-8: ERROR: missing of_node_put; acquired a node pointer with refcount incremented on line 274, but without a corresponding object release within this function. ./drivers/pci/controller/dwc/pcie-uniphier.c:296:1-7: ERROR: missing of_node_put; acquired a node pointer with refcount incremented on line 274, but without a corresponding object release within this function. Signed-off-by: Wen Yang Cc: Kunihiko Hayashi Cc: Lorenzo Pieralisi Cc: Bjorn Helgaas Cc: Masahiro Yamada Cc: linux-pci@vger.kernel.org Cc: linux-arm-kernel@lists.infradead.org Cc: linux-kernel@vger.kernel.org --- drivers/pci/controller/dwc/pcie-uniphier.c | 11 ++++++++--- 1 file changed, 8 insertions(+), 3 deletions(-) diff --git a/drivers/pci/controller/dwc/pcie-uniphier.c b/drivers/pci/controller/dwc/pcie-uniphier.c index d5dc402..3f30ee4 100644 --- a/drivers/pci/controller/dwc/pcie-uniphier.c +++ b/drivers/pci/controller/dwc/pcie-uniphier.c @@ -270,6 +270,7 @@ static int uniphier_pcie_config_legacy_irq(struct pcie_port *pp) struct uniphier_pcie_priv *priv = to_uniphier_pcie(pci); struct device_node *np = pci->dev->of_node; struct device_node *np_intc; + int ret = 0; np_intc = of_get_child_by_name(np, "legacy-interrupt-controller"); if (!np_intc) { @@ -280,20 +281,24 @@ static int uniphier_pcie_config_legacy_irq(struct pcie_port *pp) pp->irq = irq_of_parse_and_map(np_intc, 0); if (!pp->irq) { dev_err(pci->dev, "Failed to get an IRQ entry in legacy-interrupt-controller\n"); - return -EINVAL; + ret = -EINVAL; + goto out_put_node; } priv->legacy_irq_domain = irq_domain_add_linear(np_intc, PCI_NUM_INTX, &uniphier_intx_domain_ops, pp); if (!priv->legacy_irq_domain) { dev_err(pci->dev, "Failed to get INTx domain\n"); - return -ENODEV; + ret = -ENODEV; + goto out_put_node; } irq_set_chained_handler_and_data(pp->irq, uniphier_pcie_irq_handler, pp); - return 0; +out_put_node: + of_node_put(np_intc); + return ret; } static int uniphier_pcie_host_init(struct pcie_port *pp) From patchwork Wed Feb 27 04:40:38 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Wen Yang X-Patchwork-Id: 10831099 Return-Path: Received: from mail.wl.linuxfoundation.org (pdx-wl-mail.web.codeaurora.org [172.30.200.125]) by pdx-korg-patchwork-2.web.codeaurora.org (Postfix) with ESMTP id 042391575 for ; Wed, 27 Feb 2019 04:42:00 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id DDF152D31B for ; Wed, 27 Feb 2019 04:41:59 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id CE1CA2D316; Wed, 27 Feb 2019 04:41:59 +0000 (UTC) X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on pdx-wl-mail.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-5.2 required=2.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,MAILING_LIST_MULTI,RCVD_IN_DNSWL_MED autolearn=ham version=3.3.1 Received: from bombadil.infradead.org (bombadil.infradead.org [198.137.202.133]) (using TLSv1.2 with cipher AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.wl.linuxfoundation.org (Postfix) with ESMTPS id 6F9462D316 for ; Wed, 27 Feb 2019 04:41:59 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=lists.infradead.org; s=bombadil.20170209; h=Sender: Content-Transfer-Encoding:Content-Type:MIME-Version:Cc:List-Subscribe: List-Help:List-Post:List-Archive:List-Unsubscribe:List-Id:References: In-Reply-To:Message-Id:Date:Subject:To:From:Reply-To:Content-ID: Content-Description:Resent-Date:Resent-From:Resent-Sender:Resent-To:Resent-Cc :Resent-Message-ID:List-Owner; bh=buv3zCojS9RanE8RAtbKlPtMjMdUCYDrugE07JC1CJo=; b=P8kc20aXBl0gDphiUw+rMvCaY0 q6J11EoDndU0pABsGOnrN3UvGyGxdpvfeGCIA0B40QOhkzUeCqy/LRCyOETKeTF6To8Es2I3fAtym O/qPYO+PHQ3r6XnSCCUec/bug1o8jSY5rr+MVnEUgNdfxLZ6FDr+Z0++M8z8VDr3fV6FCbKcP8nl8 a4GO9/z8+YtOkXfM/Nmz9w7lTb0gccoL5wHrPkkxz5sf3MdPxsSahUC/chHXz+GzoVz2mJvguLZDv CftNYyfn6CcqxKOAvAomL5mAN7bUANPLxrjNSSKDn9WENeyF2Fv0Qvz25npTNn7QfDeH/C4h9lksW RBk/leOg==; Received: from localhost ([127.0.0.1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.90_1 #2 (Red Hat Linux)) id 1gyr2a-00060Y-9J; Wed, 27 Feb 2019 04:41:56 +0000 Received: from mxhk.zte.com.cn ([63.217.80.70]) by bombadil.infradead.org with esmtps (Exim 4.90_1 #2 (Red Hat Linux)) id 1gyr1X-0004ld-TH; Wed, 27 Feb 2019 04:40:54 +0000 Received: from mse01.zte.com.cn (unknown [10.30.3.20]) by Forcepoint Email with ESMTPS id 5D10086307C4E05DC5FE; Wed, 27 Feb 2019 12:40:46 +0800 (CST) Received: from notes_smtp.zte.com.cn ([10.30.1.239]) by mse01.zte.com.cn with ESMTP id x1R4eduq003660; Wed, 27 Feb 2019 12:40:39 +0800 (GMT-8) (envelope-from wen.yang99@zte.com.cn) Received: from fox-host8.localdomain ([10.74.120.8]) by szsmtp06.zte.com.cn (Lotus Domino Release 8.5.3FP6) with ESMTP id 2019022712405994-2029110 ; Wed, 27 Feb 2019 12:40:59 +0800 From: Wen Yang To: benh@kernel.crashing.org Subject: [PATCH 3/8] PCI: dwc: layerscape: fix a leaked reference by adding missing of_node_put Date: Wed, 27 Feb 2019 12:40:38 +0800 Message-Id: <1551242443-27300-3-git-send-email-wen.yang99@zte.com.cn> X-Mailer: git-send-email 1.8.3.1 In-Reply-To: <1551242443-27300-1-git-send-email-wen.yang99@zte.com.cn> References: <1551242443-27300-1-git-send-email-wen.yang99@zte.com.cn> X-MIMETrack: Itemize by SMTP Server on SZSMTP06/server/zte_ltd(Release 8.5.3FP6|November 21, 2013) at 2019-02-27 12:41:00, Serialize by Router on notes_smtp/zte_ltd(Release 9.0.1FP7|August 17, 2016) at 2019-02-27 12:40:31, Serialize complete at 2019-02-27 12:40:31 X-MAIL: mse01.zte.com.cn x1R4eduq003660 X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20190226_204052_100582_57EB139B X-CRM114-Status: GOOD ( 10.49 ) X-BeenThere: linux-rockchip@lists.infradead.org X-Mailman-Version: 2.1.21 Precedence: list List-Id: Upstream kernel work for Rockchip platforms List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: heiko@sntech.de, hayashi.kunihiko@socionext.com, linux-pci@vger.kernel.org, shawn.lin@rock-chips.com, minghuan.Lian@nxp.com, paulus@samba.org, thomas.petazzoni@bootlin.com, Wen Yang , ryder.lee@mediatek.com, mpe@ellerman.id.au, kishon@ti.com, linux-rockchip@lists.infradead.org, bcm-kernel-feedback-list@broadcom.com, linux-arm-kernel@lists.infradead.org, wang.yi59@zte.com.cn, rjui@broadcom.com, lorenzo.pieralisi@arm.com, linux-mediatek@lists.infradead.org, tyreld@linux.vnet.ibm.com, matthias.bgg@gmail.com, linux-omap@vger.kernel.org, mingkai.hu@nxp.com, roy.zang@nxp.com, sbranden@broadcom.com, yamada.masahiro@socionext.com, linuxppc-dev@lists.ozlabs.org, linux-kernel@vger.kernel.org, bhelgaas@google.com MIME-Version: 1.0 Sender: "Linux-rockchip" Errors-To: linux-rockchip-bounces+patchwork-linux-rockchip=patchwork.kernel.org@lists.infradead.org X-Virus-Scanned: ClamAV using ClamSMTP The call to of_parse_phandle returns a node pointer with refcount incremented thus it must be explicitly decremented after the last usage. Detected by coccinelle with the following warnings: ./drivers/pci/controller/dwc/pci-layerscape.c:204:1-7: ERROR: missing of_node_put; acquired a node pointer with refcount incremented on line 198, but without a corresponding object release within this function. Signed-off-by: Wen Yang Cc: Minghuan Lian Cc: Mingkai Hu Cc: Roy Zang Cc: Lorenzo Pieralisi Cc: Bjorn Helgaas Cc: linuxppc-dev@lists.ozlabs.org Cc: linux-pci@vger.kernel.org Cc: linux-arm-kernel@lists.infradead.org Cc: linux-kernel@vger.kernel.org --- drivers/pci/controller/dwc/pci-layerscape.c | 1 + 1 file changed, 1 insertion(+) diff --git a/drivers/pci/controller/dwc/pci-layerscape.c b/drivers/pci/controller/dwc/pci-layerscape.c index ce45bde2..3a5fa26 100644 --- a/drivers/pci/controller/dwc/pci-layerscape.c +++ b/drivers/pci/controller/dwc/pci-layerscape.c @@ -201,6 +201,7 @@ static int ls_pcie_msi_host_init(struct pcie_port *pp) return -EINVAL; } + of_node_put(msi_node); return 0; } From patchwork Wed Feb 27 04:40:39 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Wen Yang X-Patchwork-Id: 10831101 Return-Path: Received: from mail.wl.linuxfoundation.org (pdx-wl-mail.web.codeaurora.org [172.30.200.125]) by pdx-korg-patchwork-2.web.codeaurora.org (Postfix) with ESMTP id 4AE8E1575 for ; Wed, 27 Feb 2019 04:42:02 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 338572D316 for ; Wed, 27 Feb 2019 04:42:02 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id 269D52D31F; Wed, 27 Feb 2019 04:42:02 +0000 (UTC) X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on pdx-wl-mail.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-5.2 required=2.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,MAILING_LIST_MULTI,RCVD_IN_DNSWL_MED autolearn=ham version=3.3.1 Received: from bombadil.infradead.org (bombadil.infradead.org [198.137.202.133]) (using TLSv1.2 with cipher AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.wl.linuxfoundation.org (Postfix) with ESMTPS id BB3F92D316 for ; Wed, 27 Feb 2019 04:42:01 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=lists.infradead.org; s=bombadil.20170209; h=Sender: Content-Transfer-Encoding:Content-Type:MIME-Version:Cc:List-Subscribe: List-Help:List-Post:List-Archive:List-Unsubscribe:List-Id:References: In-Reply-To:Message-Id:Date:Subject:To:From:Reply-To:Content-ID: Content-Description:Resent-Date:Resent-From:Resent-Sender:Resent-To:Resent-Cc :Resent-Message-ID:List-Owner; bh=YGZ3ZKZv6py2ZKdPhcFyzjHGxq/WwcRMjUoq3Pg1Yd0=; b=CQ3PPAYjs7crEjZC/VTO1HUqs1 rShbv8Ec02kiYxxbTZymYhLbXrWF+VLdK7LdlO9ys2DGvSbWMdftYusWbKHjz89DmLdOmLkoTbXrt q8XOjiLBY9ALJiSgASUPTmr6pgrJSKCQ0wzhfvWIoxJWcxNLo58azmZ66UjfOt8XMtb5HYDGqNDA/ r8dBibqBbTiqOR+RSzoLao2m0vJxxsEDjOcKQwagPHzLZC8iTuiBz9UGD6etMoxjruh1kLKpThLo3 JzmpICtED20Oc7Lr++LkhSZXek1ZwMNY3Zj3rMtrbmgcKzAqTDEmvTrqmNNP5MMFFMxUw+a4inQ0y uXfv2mBA==; Received: from localhost ([127.0.0.1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.90_1 #2 (Red Hat Linux)) id 1gyr2b-00062o-Sm; Wed, 27 Feb 2019 04:41:57 +0000 Received: from out1.zte.com.cn ([202.103.147.172] helo=mxct.zte.com.cn) by bombadil.infradead.org with esmtps (Exim 4.90_1 #2 (Red Hat Linux)) id 1gyr1Y-0004ly-TE; Wed, 27 Feb 2019 04:40:54 +0000 Received: from mse01.zte.com.cn (unknown [10.30.3.20]) by Forcepoint Email with ESMTPS id 8A565DC04187BD37D4FC; Wed, 27 Feb 2019 12:40:47 +0800 (CST) Received: from notes_smtp.zte.com.cn ([10.30.1.239]) by mse01.zte.com.cn with ESMTP id x1R4efqI003675; Wed, 27 Feb 2019 12:40:41 +0800 (GMT-8) (envelope-from wen.yang99@zte.com.cn) Received: from fox-host8.localdomain ([10.74.120.8]) by szsmtp06.zte.com.cn (Lotus Domino Release 8.5.3FP6) with ESMTP id 2019022712410218-2029116 ; Wed, 27 Feb 2019 12:41:02 +0800 From: Wen Yang To: benh@kernel.crashing.org Subject: [PATCH 4/8] PCI: rockchip: fix a leaked reference by adding missing of_node_put Date: Wed, 27 Feb 2019 12:40:39 +0800 Message-Id: <1551242443-27300-4-git-send-email-wen.yang99@zte.com.cn> X-Mailer: git-send-email 1.8.3.1 In-Reply-To: <1551242443-27300-1-git-send-email-wen.yang99@zte.com.cn> References: <1551242443-27300-1-git-send-email-wen.yang99@zte.com.cn> X-MIMETrack: Itemize by SMTP Server on SZSMTP06/server/zte_ltd(Release 8.5.3FP6|November 21, 2013) at 2019-02-27 12:41:02, Serialize by Router on notes_smtp/zte_ltd(Release 9.0.1FP7|August 17, 2016) at 2019-02-27 12:40:34, Serialize complete at 2019-02-27 12:40:34 X-MAIL: mse01.zte.com.cn x1R4efqI003675 X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20190226_204053_240050_8ABC0165 X-CRM114-Status: GOOD ( 11.33 ) X-BeenThere: linux-rockchip@lists.infradead.org X-Mailman-Version: 2.1.21 Precedence: list List-Id: Upstream kernel work for Rockchip platforms List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: heiko@sntech.de, hayashi.kunihiko@socionext.com, linux-pci@vger.kernel.org, shawn.lin@rock-chips.com, minghuan.Lian@nxp.com, paulus@samba.org, thomas.petazzoni@bootlin.com, Wen Yang , ryder.lee@mediatek.com, mpe@ellerman.id.au, kishon@ti.com, linux-rockchip@lists.infradead.org, bcm-kernel-feedback-list@broadcom.com, linux-arm-kernel@lists.infradead.org, wang.yi59@zte.com.cn, rjui@broadcom.com, lorenzo.pieralisi@arm.com, linux-mediatek@lists.infradead.org, tyreld@linux.vnet.ibm.com, matthias.bgg@gmail.com, linux-omap@vger.kernel.org, mingkai.hu@nxp.com, roy.zang@nxp.com, sbranden@broadcom.com, yamada.masahiro@socionext.com, linuxppc-dev@lists.ozlabs.org, linux-kernel@vger.kernel.org, bhelgaas@google.com MIME-Version: 1.0 Sender: "Linux-rockchip" Errors-To: linux-rockchip-bounces+patchwork-linux-rockchip=patchwork.kernel.org@lists.infradead.org X-Virus-Scanned: ClamAV using ClamSMTP The call to of_get_child_by_name returns a node pointer with refcount incremented thus it must be explicitly decremented after the last usage. irq_domain_add_linear also calls of_node_get to increase refcount, so irq_domain will not be affected when it is released. Detected by coccinelle with the following warnings: ./drivers/pci/controller/pcie-rockchip-host.c:729:2-8: ERROR: missing of_node_put; acquired a node pointer with refcount incremented on line 718, but without a corresponding object release within this function. ./drivers/pci/controller/pcie-rockchip-host.c:732:1-7: ERROR: missing of_node_put; acquired a node pointer with refcount incremented on line 718, but without a corresponding object release within this function. Signed-off-by: Wen Yang Cc: Shawn Lin Cc: Lorenzo Pieralisi Cc: Bjorn Helgaas Cc: Heiko Stuebner Cc: linux-pci@vger.kernel.org Cc: linux-rockchip@lists.infradead.org Cc: linux-arm-kernel@lists.infradead.org Cc: linux-kernel@vger.kernel.org --- drivers/pci/controller/pcie-rockchip-host.c | 1 + 1 file changed, 1 insertion(+) diff --git a/drivers/pci/controller/pcie-rockchip-host.c b/drivers/pci/controller/pcie-rockchip-host.c index 1372d27..8d20f17 100644 --- a/drivers/pci/controller/pcie-rockchip-host.c +++ b/drivers/pci/controller/pcie-rockchip-host.c @@ -724,6 +724,7 @@ static int rockchip_pcie_init_irq_domain(struct rockchip_pcie *rockchip) rockchip->irq_domain = irq_domain_add_linear(intc, PCI_NUM_INTX, &intx_domain_ops, rockchip); + of_node_put(intc); if (!rockchip->irq_domain) { dev_err(dev, "failed to get a INTx IRQ domain\n"); return -EINVAL; From patchwork Wed Feb 27 04:40:40 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Wen Yang X-Patchwork-Id: 10831109 Return-Path: Received: from mail.wl.linuxfoundation.org (pdx-wl-mail.web.codeaurora.org [172.30.200.125]) by pdx-korg-patchwork-2.web.codeaurora.org (Postfix) with ESMTP id 4FFFF922 for ; Wed, 27 Feb 2019 04:42:18 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 395882D32E for ; Wed, 27 Feb 2019 04:42:18 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id 2960E2D332; Wed, 27 Feb 2019 04:42:18 +0000 (UTC) X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on pdx-wl-mail.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-5.2 required=2.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,MAILING_LIST_MULTI,RCVD_IN_DNSWL_MED autolearn=unavailable version=3.3.1 Received: from bombadil.infradead.org (bombadil.infradead.org [198.137.202.133]) (using TLSv1.2 with cipher AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.wl.linuxfoundation.org (Postfix) with ESMTPS id C369C2D32E for ; Wed, 27 Feb 2019 04:42:17 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=lists.infradead.org; s=bombadil.20170209; h=Sender: Content-Transfer-Encoding:Content-Type:MIME-Version:Cc:List-Subscribe: List-Help:List-Post:List-Archive:List-Unsubscribe:List-Id:References: In-Reply-To:Message-Id:Date:Subject:To:From:Reply-To:Content-ID: Content-Description:Resent-Date:Resent-From:Resent-Sender:Resent-To:Resent-Cc :Resent-Message-ID:List-Owner; bh=BK+Fe10tKPmjRwNLIVj7Z8ULhOokCD2LDkW1QJhNH14=; b=ex2IwlsLTeqBZ25PauXf1PrM5G dSq6TxqlsBxVeJf0AsAmwkOZPMWE6IhZCClZqf70TefCdONKN/+eVLhkmn7VCChrhUpcG8Msb5mM/ w8oFoUsphHXHNbZJjFznkSjDyAMpxul8XQHrcCQtcB2NcvTvkpUsTNt60gN12TpF1OjZ9ui5o/QFM NmqIdzmxw5WokKVcIF1xlp1S3KPVQ90UnASoemoP6gQrjT50VToQgLwflIUM2oa7qj2WD76E24RG8 WFxkiM3UL2nkga+F70XBC2poSqwzA4YXAiCdKuhwr4E+t/D/D6mCeKTTHzhqB9FUf2A27+j8gwk6r RXXLE06A==; Received: from localhost ([127.0.0.1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.90_1 #2 (Red Hat Linux)) id 1gyr2q-0006Oc-G3; Wed, 27 Feb 2019 04:42:12 +0000 Received: from out1.zte.com.cn ([202.103.147.172] helo=mxct.zte.com.cn) by bombadil.infradead.org with esmtps (Exim 4.90_1 #2 (Red Hat Linux)) id 1gyr1b-0004no-0W; Wed, 27 Feb 2019 04:40:59 +0000 Received: from mse01.zte.com.cn (unknown [10.30.3.20]) by Forcepoint Email with ESMTPS id 69CC474E1EE0FF3A0483; Wed, 27 Feb 2019 12:40:53 +0800 (CST) Received: from notes_smtp.zte.com.cn ([10.30.1.239]) by mse01.zte.com.cn with ESMTP id x1R4em8h003706; Wed, 27 Feb 2019 12:40:48 +0800 (GMT-8) (envelope-from wen.yang99@zte.com.cn) Received: from fox-host8.localdomain ([10.74.120.8]) by szsmtp06.zte.com.cn (Lotus Domino Release 8.5.3FP6) with ESMTP id 2019022712410885-2029139 ; Wed, 27 Feb 2019 12:41:08 +0800 From: Wen Yang To: benh@kernel.crashing.org Subject: [PATCH 5/8] PCI: aardvark: fix a leaked reference by adding missing of_node_put Date: Wed, 27 Feb 2019 12:40:40 +0800 Message-Id: <1551242443-27300-5-git-send-email-wen.yang99@zte.com.cn> X-Mailer: git-send-email 1.8.3.1 In-Reply-To: <1551242443-27300-1-git-send-email-wen.yang99@zte.com.cn> References: <1551242443-27300-1-git-send-email-wen.yang99@zte.com.cn> X-MIMETrack: Itemize by SMTP Server on SZSMTP06/server/zte_ltd(Release 8.5.3FP6|November 21, 2013) at 2019-02-27 12:41:09, Serialize by Router on notes_smtp/zte_ltd(Release 9.0.1FP7|August 17, 2016) at 2019-02-27 12:40:40, Serialize complete at 2019-02-27 12:40:40 X-MAIL: mse01.zte.com.cn x1R4em8h003706 X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20190226_204055_534510_505C4511 X-CRM114-Status: GOOD ( 12.86 ) X-BeenThere: linux-rockchip@lists.infradead.org X-Mailman-Version: 2.1.21 Precedence: list List-Id: Upstream kernel work for Rockchip platforms List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: heiko@sntech.de, hayashi.kunihiko@socionext.com, linux-pci@vger.kernel.org, shawn.lin@rock-chips.com, minghuan.Lian@nxp.com, paulus@samba.org, thomas.petazzoni@bootlin.com, Wen Yang , ryder.lee@mediatek.com, mpe@ellerman.id.au, kishon@ti.com, linux-rockchip@lists.infradead.org, bcm-kernel-feedback-list@broadcom.com, linux-arm-kernel@lists.infradead.org, wang.yi59@zte.com.cn, rjui@broadcom.com, lorenzo.pieralisi@arm.com, linux-mediatek@lists.infradead.org, tyreld@linux.vnet.ibm.com, matthias.bgg@gmail.com, linux-omap@vger.kernel.org, mingkai.hu@nxp.com, roy.zang@nxp.com, sbranden@broadcom.com, yamada.masahiro@socionext.com, linuxppc-dev@lists.ozlabs.org, linux-kernel@vger.kernel.org, bhelgaas@google.com MIME-Version: 1.0 Sender: "Linux-rockchip" Errors-To: linux-rockchip-bounces+patchwork-linux-rockchip=patchwork.kernel.org@lists.infradead.org X-Virus-Scanned: ClamAV using ClamSMTP The call to of_get_next_child returns a node pointer with refcount incremented thus it must be explicitly decremented after the last usage. irq_domain_add_linear also calls of_node_get to increase refcount, so irq_domain will not be affected when it is released. Detected by coccinelle with the following warnings: ./drivers/pci/controller/pci-aardvark.c:826:1-7: ERROR: missing of_node_put; acquired a node pointer with refcount incremented on line 798, but without a corresponding object release within this function. Signed-off-by: Wen Yang Cc: Thomas Petazzoni Cc: Lorenzo Pieralisi Cc: Bjorn Helgaas Cc: linux-pci@vger.kernel.org Cc: linux-arm-kernel@lists.infradead.org Cc: linux-kernel@vger.kernel.org --- drivers/pci/controller/pci-aardvark.c | 13 ++++++++----- 1 file changed, 8 insertions(+), 5 deletions(-) diff --git a/drivers/pci/controller/pci-aardvark.c b/drivers/pci/controller/pci-aardvark.c index 750081c..56ecb16 100644 --- a/drivers/pci/controller/pci-aardvark.c +++ b/drivers/pci/controller/pci-aardvark.c @@ -794,6 +794,7 @@ static int advk_pcie_init_irq_domain(struct advk_pcie *pcie) struct device_node *node = dev->of_node; struct device_node *pcie_intc_node; struct irq_chip *irq_chip; + int ret = 0; pcie_intc_node = of_get_next_child(node, NULL); if (!pcie_intc_node) { @@ -806,8 +807,8 @@ static int advk_pcie_init_irq_domain(struct advk_pcie *pcie) irq_chip->name = devm_kasprintf(dev, GFP_KERNEL, "%s-irq", dev_name(dev)); if (!irq_chip->name) { - of_node_put(pcie_intc_node); - return -ENOMEM; + ret = -ENOMEM; + goto out_put_node; } irq_chip->irq_mask = advk_pcie_irq_mask; @@ -819,11 +820,13 @@ static int advk_pcie_init_irq_domain(struct advk_pcie *pcie) &advk_pcie_irq_domain_ops, pcie); if (!pcie->irq_domain) { dev_err(dev, "Failed to get a INTx IRQ domain\n"); - of_node_put(pcie_intc_node); - return -ENOMEM; + ret = -ENOMEM; + goto out_put_node; } - return 0; +out_put_node: + of_node_put(pcie_intc_node); + return ret; } static void advk_pcie_remove_irq_domain(struct advk_pcie *pcie) From patchwork Wed Feb 27 04:40:41 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Wen Yang X-Patchwork-Id: 10831119 Return-Path: Received: from mail.wl.linuxfoundation.org (pdx-wl-mail.web.codeaurora.org [172.30.200.125]) by pdx-korg-patchwork-2.web.codeaurora.org (Postfix) with ESMTP id 21FE8922 for ; Wed, 27 Feb 2019 04:42:46 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 08D2F2D31B for ; Wed, 27 Feb 2019 04:42:46 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id EE9562D327; Wed, 27 Feb 2019 04:42:45 +0000 (UTC) X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on pdx-wl-mail.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-5.2 required=2.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,MAILING_LIST_MULTI,RCVD_IN_DNSWL_MED autolearn=unavailable version=3.3.1 Received: from bombadil.infradead.org (bombadil.infradead.org [198.137.202.133]) (using TLSv1.2 with cipher AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.wl.linuxfoundation.org (Postfix) with ESMTPS id D46EE2D31B for ; Wed, 27 Feb 2019 04:42:44 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=lists.infradead.org; s=bombadil.20170209; h=Sender: Content-Transfer-Encoding:Content-Type:MIME-Version:Cc:List-Subscribe: List-Help:List-Post:List-Archive:List-Unsubscribe:List-Id:References: In-Reply-To:Message-Id:Date:Subject:To:From:Reply-To:Content-ID: Content-Description:Resent-Date:Resent-From:Resent-Sender:Resent-To:Resent-Cc :Resent-Message-ID:List-Owner; bh=PAbi0PHR8CjO5Bzt3hSJkdX4uIVlsUeeS+CDtwuWOE0=; b=NfLsYmjz10mtjZVq81VC6WZAy7 tM9gdhdRbRTdTGKpeRyGdnTnfF2n87zTD1gQMqdwYKdQxlEmB0gcQ3lM6p/dqhpFTcUYBR0nCw7Xb IxIu1wa1BIxbN1qvPIwlUgrIuY+hA6+H68EmR4SYchmBm3rvPNgrUjOWOk9H0V+SNkKrb7ZnPZuMR bf8ulWCfB7Scsop2o6cBHfB9uFhzFrMWpn/90HZ8g2ouMzNuJTwmWgnXmL/UqbjLqpa1HWRY1ZKD+ KTIykCLmaKrZ/AEtBEAgD7RR/UFH4S3ZgacHU7MODtrrgALmFgIBx0cv9H0yYCqGhhIcSSzdc++Uo vj7z0dDA==; Received: from localhost ([127.0.0.1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.90_1 #2 (Red Hat Linux)) id 1gyr3J-0007AQ-2f; Wed, 27 Feb 2019 04:42:41 +0000 Received: from out1.zte.com.cn ([202.103.147.172] helo=mxct.zte.com.cn) by bombadil.infradead.org with esmtps (Exim 4.90_1 #2 (Red Hat Linux)) id 1gyr1i-0004yC-Dq; Wed, 27 Feb 2019 04:41:11 +0000 Received: from mse01.zte.com.cn (unknown [10.30.3.20]) by Forcepoint Email with ESMTPS id EC684EE095B8F1DF705A; Wed, 27 Feb 2019 12:41:00 +0800 (CST) Received: from notes_smtp.zte.com.cn ([10.30.1.239]) by mse01.zte.com.cn with ESMTP id x1R4eoKe003741; Wed, 27 Feb 2019 12:40:50 +0800 (GMT-8) (envelope-from wen.yang99@zte.com.cn) Received: from fox-host8.localdomain ([10.74.120.8]) by szsmtp06.zte.com.cn (Lotus Domino Release 8.5.3FP6) with ESMTP id 2019022712411163-2029141 ; Wed, 27 Feb 2019 12:41:11 +0800 From: Wen Yang To: benh@kernel.crashing.org Subject: [PATCH 6/8] PCI: iproc: fix a leaked reference by adding missing of_node_put Date: Wed, 27 Feb 2019 12:40:41 +0800 Message-Id: <1551242443-27300-6-git-send-email-wen.yang99@zte.com.cn> X-Mailer: git-send-email 1.8.3.1 In-Reply-To: <1551242443-27300-1-git-send-email-wen.yang99@zte.com.cn> References: <1551242443-27300-1-git-send-email-wen.yang99@zte.com.cn> X-MIMETrack: Itemize by SMTP Server on SZSMTP06/server/zte_ltd(Release 8.5.3FP6|November 21, 2013) at 2019-02-27 12:41:11, Serialize by Router on notes_smtp/zte_ltd(Release 9.0.1FP7|August 17, 2016) at 2019-02-27 12:40:43, Serialize complete at 2019-02-27 12:40:43 X-MAIL: mse01.zte.com.cn x1R4eoKe003741 X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20190226_204103_213546_AA33C8FF X-CRM114-Status: GOOD ( 13.51 ) X-BeenThere: linux-rockchip@lists.infradead.org X-Mailman-Version: 2.1.21 Precedence: list List-Id: Upstream kernel work for Rockchip platforms List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: heiko@sntech.de, hayashi.kunihiko@socionext.com, linux-pci@vger.kernel.org, shawn.lin@rock-chips.com, minghuan.Lian@nxp.com, paulus@samba.org, thomas.petazzoni@bootlin.com, Wen Yang , ryder.lee@mediatek.com, mpe@ellerman.id.au, kishon@ti.com, linux-rockchip@lists.infradead.org, bcm-kernel-feedback-list@broadcom.com, linux-arm-kernel@lists.infradead.org, wang.yi59@zte.com.cn, rjui@broadcom.com, lorenzo.pieralisi@arm.com, linux-mediatek@lists.infradead.org, tyreld@linux.vnet.ibm.com, matthias.bgg@gmail.com, linux-omap@vger.kernel.org, mingkai.hu@nxp.com, roy.zang@nxp.com, sbranden@broadcom.com, yamada.masahiro@socionext.com, linuxppc-dev@lists.ozlabs.org, linux-kernel@vger.kernel.org, bhelgaas@google.com MIME-Version: 1.0 Sender: "Linux-rockchip" Errors-To: linux-rockchip-bounces+patchwork-linux-rockchip=patchwork.kernel.org@lists.infradead.org X-Virus-Scanned: ClamAV using ClamSMTP The call to of_parse_phandle returns a node pointer with refcount incremented thus it must be explicitly decremented after the last usage. iproc_msi_init also calls of_node_get to increase refcount (proc_msi_init -> iproc_msi_alloc_domains -> pci_msi_create_irq_domain -> msi_create_irq_domain -> irq_domain_create_linear -> __irq_domain_add), so irq_domain will not be affected when it is released. Detected by coccinelle with the following warnings: ./drivers/pci/controller/pcie-iproc.c:1323:3-9: ERROR: missing of_node_put; acquired a node pointer with refcount incremented on line 1299, but without a corresponding object release within this function. ./drivers/pci/controller/pcie-iproc.c:1330:1-7: ERROR: missing of_node_put; acquired a node pointer with refcount incremented on line 1299, but without a corresponding object release within this function. Signed-off-by: Wen Yang Cc: Lorenzo Pieralisi Cc: Bjorn Helgaas Cc: Ray Jui Cc: Scott Branden Cc: bcm-kernel-feedback-list@broadcom.com Cc: linux-pci@vger.kernel.org Cc: linux-arm-kernel@lists.infradead.org Cc: linux-kernel@vger.kernel.org --- drivers/pci/controller/pcie-iproc.c | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) diff --git a/drivers/pci/controller/pcie-iproc.c b/drivers/pci/controller/pcie-iproc.c index c20fd6b..9998c5c 100644 --- a/drivers/pci/controller/pcie-iproc.c +++ b/drivers/pci/controller/pcie-iproc.c @@ -1320,14 +1320,18 @@ static int iproc_pcie_msi_enable(struct iproc_pcie *pcie) if (pcie->need_msi_steer) { ret = iproc_pcie_msi_steer(pcie, msi_node); if (ret) - return ret; + goto out_put_node; } /* * If another MSI controller is being used, the call below should fail * but that is okay */ - return iproc_msi_init(pcie, msi_node); + ret = iproc_msi_init(pcie, msi_node); + +out_put_node: + of_node_put(msi_node); + return ret; } static void iproc_pcie_msi_disable(struct iproc_pcie *pcie) From patchwork Wed Feb 27 04:40:42 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Wen Yang X-Patchwork-Id: 10831123 Return-Path: Received: from mail.wl.linuxfoundation.org (pdx-wl-mail.web.codeaurora.org [172.30.200.125]) by pdx-korg-patchwork-2.web.codeaurora.org (Postfix) with ESMTP id 21E881575 for ; Wed, 27 Feb 2019 04:42:49 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 0761D2D31B for ; Wed, 27 Feb 2019 04:42:49 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id EED152D327; Wed, 27 Feb 2019 04:42:48 +0000 (UTC) X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on pdx-wl-mail.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-5.2 required=2.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,MAILING_LIST_MULTI,RCVD_IN_DNSWL_MED autolearn=unavailable version=3.3.1 Received: from bombadil.infradead.org (bombadil.infradead.org [198.137.202.133]) (using TLSv1.2 with cipher AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.wl.linuxfoundation.org (Postfix) with ESMTPS id 9AB2C2D31B for ; Wed, 27 Feb 2019 04:42:47 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=lists.infradead.org; s=bombadil.20170209; h=Sender: Content-Transfer-Encoding:Content-Type:MIME-Version:Cc:List-Subscribe: List-Help:List-Post:List-Archive:List-Unsubscribe:List-Id:References: In-Reply-To:Message-Id:Date:Subject:To:From:Reply-To:Content-ID: Content-Description:Resent-Date:Resent-From:Resent-Sender:Resent-To:Resent-Cc :Resent-Message-ID:List-Owner; bh=EQXWKA8iL8rq/Ry8IIhBD7WKsxe96kRqLUMh19DyaW4=; b=TvOQf1nHfwJja42nmb+fbbnpXN 0W0P5oL3pRa7+MAlnkt3I39bxgqDVhRfsEy7s+WzWMaE5fgHH1ubyk1rCoWul93+QLl2Y59KPsapb uH+o0DwmeTCjtHt38yBV5508GVZdEA+rkuKtZZ4hagUBTjzBVo/myjFcgSzaaF83jQnXvvizLHxKj E9A0DESZ4bpjoiF5D0HemwKhzz4k60MYBle7QkeIaPHUBI8NMiK0IPWV0IqbO4ibVgs8awBQaX1fW PQryoW8B2W6DECyBhQrH4kjKC5H9OWKBYPm9kpqf1vakCO4vAGK7eZy9mHLG9fK/A84AZ3JA1IgM5 uJMMjG/g==; Received: from localhost ([127.0.0.1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.90_1 #2 (Red Hat Linux)) id 1gyr3M-0007Fn-QH; Wed, 27 Feb 2019 04:42:44 +0000 Received: from out1.zte.com.cn ([202.103.147.172] helo=mxct.zte.com.cn) by bombadil.infradead.org with esmtps (Exim 4.90_1 #2 (Red Hat Linux)) id 1gyr1l-00052s-4Z; Wed, 27 Feb 2019 04:41:13 +0000 Received: from mse01.zte.com.cn (unknown [10.30.3.20]) by Forcepoint Email with ESMTPS id C5986E7FC1E71E940983; Wed, 27 Feb 2019 12:41:03 +0800 (CST) Received: from notes_smtp.zte.com.cn ([10.30.1.239]) by mse01.zte.com.cn with ESMTP id x1R4er4r003758; Wed, 27 Feb 2019 12:40:53 +0800 (GMT-8) (envelope-from wen.yang99@zte.com.cn) Received: from fox-host8.localdomain ([10.74.120.8]) by szsmtp06.zte.com.cn (Lotus Domino Release 8.5.3FP6) with ESMTP id 2019022712411405-2029145 ; Wed, 27 Feb 2019 12:41:14 +0800 From: Wen Yang To: benh@kernel.crashing.org Subject: [PATCH 7/8] PCI: mediatek: fix a leaked reference by adding missing of_node_put Date: Wed, 27 Feb 2019 12:40:42 +0800 Message-Id: <1551242443-27300-7-git-send-email-wen.yang99@zte.com.cn> X-Mailer: git-send-email 1.8.3.1 In-Reply-To: <1551242443-27300-1-git-send-email-wen.yang99@zte.com.cn> References: <1551242443-27300-1-git-send-email-wen.yang99@zte.com.cn> X-MIMETrack: Itemize by SMTP Server on SZSMTP06/server/zte_ltd(Release 8.5.3FP6|November 21, 2013) at 2019-02-27 12:41:14, Serialize by Router on notes_smtp/zte_ltd(Release 9.0.1FP7|August 17, 2016) at 2019-02-27 12:40:45, Serialize complete at 2019-02-27 12:40:45 X-MAIL: mse01.zte.com.cn x1R4er4r003758 X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20190226_204105_741417_AE1DF6F6 X-CRM114-Status: GOOD ( 11.08 ) X-BeenThere: linux-rockchip@lists.infradead.org X-Mailman-Version: 2.1.21 Precedence: list List-Id: Upstream kernel work for Rockchip platforms List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: heiko@sntech.de, hayashi.kunihiko@socionext.com, linux-pci@vger.kernel.org, shawn.lin@rock-chips.com, minghuan.Lian@nxp.com, paulus@samba.org, thomas.petazzoni@bootlin.com, Wen Yang , ryder.lee@mediatek.com, mpe@ellerman.id.au, kishon@ti.com, linux-rockchip@lists.infradead.org, bcm-kernel-feedback-list@broadcom.com, linux-arm-kernel@lists.infradead.org, wang.yi59@zte.com.cn, rjui@broadcom.com, lorenzo.pieralisi@arm.com, linux-mediatek@lists.infradead.org, tyreld@linux.vnet.ibm.com, matthias.bgg@gmail.com, linux-omap@vger.kernel.org, mingkai.hu@nxp.com, roy.zang@nxp.com, sbranden@broadcom.com, yamada.masahiro@socionext.com, linuxppc-dev@lists.ozlabs.org, linux-kernel@vger.kernel.org, bhelgaas@google.com MIME-Version: 1.0 Sender: "Linux-rockchip" Errors-To: linux-rockchip-bounces+patchwork-linux-rockchip=patchwork.kernel.org@lists.infradead.org X-Virus-Scanned: ClamAV using ClamSMTP The call to of_get_next_child returns a node pointer with refcount incremented thus it must be explicitly decremented after the last usage. irq_domain_add_linear also calls of_node_get to increase refcount, so irq_domain will not be affected when it is released. Detected by coccinelle with the following warnings: ./drivers/pci/controller/pcie-mediatek.c:577:2-8: ERROR: missing of_node_put; acquired a node pointer with refcount incremented on line 567, but without a corresponding object release within this function. ./drivers/pci/controller/pcie-mediatek.c:583:3-9: ERROR: missing of_node_put; acquired a node pointer with refcount incremented on line 567, but without a corresponding object release within this function. ./drivers/pci/controller/pcie-mediatek.c:586:1-7: ERROR: missing of_node_put; acquired a node pointer with refcount incremented on line 567, but without a corresponding object release within this function. Signed-off-by: Wen Yang Cc: Ryder Lee Cc: Lorenzo Pieralisi Cc: Bjorn Helgaas Cc: Matthias Brugger Cc: linux-pci@vger.kernel.org Cc: linux-mediatek@lists.infradead.org Cc: linux-kernel@vger.kernel.org Cc: linux-arm-kernel@lists.infradead.org Acked-by: Honghui Zhang --- drivers/pci/controller/pcie-mediatek.c | 1 + 1 file changed, 1 insertion(+) diff --git a/drivers/pci/controller/pcie-mediatek.c b/drivers/pci/controller/pcie-mediatek.c index 55e471c..e91716a 100644 --- a/drivers/pci/controller/pcie-mediatek.c +++ b/drivers/pci/controller/pcie-mediatek.c @@ -572,6 +572,7 @@ static int mtk_pcie_init_irq_domain(struct mtk_pcie_port *port, port->irq_domain = irq_domain_add_linear(pcie_intc_node, PCI_NUM_INTX, &intx_domain_ops, port); + of_node_put(pcie_intc_node); if (!port->irq_domain) { dev_err(dev, "failed to get INTx IRQ domain\n"); return -ENODEV; From patchwork Wed Feb 27 04:40:43 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Wen Yang X-Patchwork-Id: 10831127 Return-Path: Received: from mail.wl.linuxfoundation.org (pdx-wl-mail.web.codeaurora.org [172.30.200.125]) by pdx-korg-patchwork-2.web.codeaurora.org (Postfix) with ESMTP id 7F3DA1575 for ; Wed, 27 Feb 2019 04:43:03 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 678872D31B for ; Wed, 27 Feb 2019 04:43:03 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id 597922D32E; Wed, 27 Feb 2019 04:43:03 +0000 (UTC) X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on pdx-wl-mail.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-5.2 required=2.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,MAILING_LIST_MULTI,RCVD_IN_DNSWL_MED autolearn=ham version=3.3.1 Received: from bombadil.infradead.org (bombadil.infradead.org [198.137.202.133]) (using TLSv1.2 with cipher AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.wl.linuxfoundation.org (Postfix) with ESMTPS id 12EB22D31B for ; Wed, 27 Feb 2019 04:43:02 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=lists.infradead.org; s=bombadil.20170209; h=Sender: Content-Transfer-Encoding:Content-Type:MIME-Version:Cc:List-Subscribe: List-Help:List-Post:List-Archive:List-Unsubscribe:List-Id:References: In-Reply-To:Message-Id:Date:Subject:To:From:Reply-To:Content-ID: Content-Description:Resent-Date:Resent-From:Resent-Sender:Resent-To:Resent-Cc :Resent-Message-ID:List-Owner; bh=oU8XX/pB/wXCfCEL1/6TFQ31SdvYyN4+wXw7If75I9c=; b=LwWmxQm+S2z1LAyu45AmEax4QR oH6zYnRYwzewEidGnlRjJ0igsTKVoxnIG/7TDU0RK5QmqPxSmFdrWjRxMTXd52u3NHwu3tuhPfYhf ci19GtGKi/sBecZqw+HUlkK5NET8wrBiJXxcfqsZgDrvK0B7qUliifW6rXQM+p1xm7fMrCD8pPrKA wcacnu6+NwZqt8tq3qaz5aFpRS3HJCfnnDovlRCRQD4bjuHmbSftGyM0mQsFHMYKm+vHnp9Ry5Ufk OpG3Rc6xAqhJoKX7ps/DZkduwY1WrXm86W/ge6QqaewmyT2Ph+0jORGQWsaMAwi12TxK3jfdRu8nW CExKdlgA==; Received: from localhost ([127.0.0.1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.90_1 #2 (Red Hat Linux)) id 1gyr3a-0007ah-GH; Wed, 27 Feb 2019 04:42:58 +0000 Received: from out1.zte.com.cn ([202.103.147.172] helo=mxct.zte.com.cn) by bombadil.infradead.org with esmtps (Exim 4.90_1 #2 (Red Hat Linux)) id 1gyr1n-00055x-1I; Wed, 27 Feb 2019 04:41:15 +0000 Received: from mse01.zte.com.cn (unknown [10.30.3.20]) by Forcepoint Email with ESMTPS id 8E9CD2854E3034C164C2; Wed, 27 Feb 2019 12:41:05 +0800 (CST) Received: from notes_smtp.zte.com.cn ([10.30.1.239]) by mse01.zte.com.cn with ESMTP id x1R4etdZ003794; Wed, 27 Feb 2019 12:40:55 +0800 (GMT-8) (envelope-from wen.yang99@zte.com.cn) Received: from fox-host8.localdomain ([10.74.120.8]) by szsmtp06.zte.com.cn (Lotus Domino Release 8.5.3FP6) with ESMTP id 2019022712411629-2029149 ; Wed, 27 Feb 2019 12:41:16 +0800 From: Wen Yang To: benh@kernel.crashing.org Subject: [PATCH 8/8] PCI: rpadlpar: fix a leaked reference by adding missing of_node_put Date: Wed, 27 Feb 2019 12:40:43 +0800 Message-Id: <1551242443-27300-8-git-send-email-wen.yang99@zte.com.cn> X-Mailer: git-send-email 1.8.3.1 In-Reply-To: <1551242443-27300-1-git-send-email-wen.yang99@zte.com.cn> References: <1551242443-27300-1-git-send-email-wen.yang99@zte.com.cn> X-MIMETrack: Itemize by SMTP Server on SZSMTP06/server/zte_ltd(Release 8.5.3FP6|November 21, 2013) at 2019-02-27 12:41:16, Serialize by Router on notes_smtp/zte_ltd(Release 9.0.1FP7|August 17, 2016) at 2019-02-27 12:40:48, Serialize complete at 2019-02-27 12:40:48 X-MAIL: mse01.zte.com.cn x1R4etdZ003794 X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20190226_204107_925882_070530DA X-CRM114-Status: UNSURE ( 9.85 ) X-CRM114-Notice: Please train this message. X-BeenThere: linux-rockchip@lists.infradead.org X-Mailman-Version: 2.1.21 Precedence: list List-Id: Upstream kernel work for Rockchip platforms List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: heiko@sntech.de, hayashi.kunihiko@socionext.com, linux-pci@vger.kernel.org, shawn.lin@rock-chips.com, minghuan.Lian@nxp.com, paulus@samba.org, thomas.petazzoni@bootlin.com, Wen Yang , ryder.lee@mediatek.com, mpe@ellerman.id.au, kishon@ti.com, linux-rockchip@lists.infradead.org, bcm-kernel-feedback-list@broadcom.com, linux-arm-kernel@lists.infradead.org, wang.yi59@zte.com.cn, rjui@broadcom.com, lorenzo.pieralisi@arm.com, linux-mediatek@lists.infradead.org, tyreld@linux.vnet.ibm.com, matthias.bgg@gmail.com, linux-omap@vger.kernel.org, mingkai.hu@nxp.com, roy.zang@nxp.com, sbranden@broadcom.com, yamada.masahiro@socionext.com, linuxppc-dev@lists.ozlabs.org, linux-kernel@vger.kernel.org, bhelgaas@google.com MIME-Version: 1.0 Sender: "Linux-rockchip" Errors-To: linux-rockchip-bounces+patchwork-linux-rockchip=patchwork.kernel.org@lists.infradead.org X-Virus-Scanned: ClamAV using ClamSMTP The call to of_find_node_by_name returns a node pointer with refcount incremented thus it must be explicitly decremented after the last usage. Detected by coccinelle with the following warnings: ./drivers/pci/hotplug/rpadlpar_core.c:55:1-7: ERROR: missing of_node_put; acquired a node pointer with refcount incremented on line 42, but without a corresponding object release within this function Signed-off-by: Wen Yang Cc: Tyrel Datwyler Cc: Benjamin Herrenschmidt Cc: Paul Mackerras Cc: Michael Ellerman Cc: Bjorn Helgaas Cc: linux-pci@vger.kernel.org Cc: linuxppc-dev@lists.ozlabs.org Cc: linux-kernel@vger.kernel.org --- drivers/pci/hotplug/rpadlpar_core.c | 1 + 1 file changed, 1 insertion(+) diff --git a/drivers/pci/hotplug/rpadlpar_core.c b/drivers/pci/hotplug/rpadlpar_core.c index e2356a9..f3f42ff 100644 --- a/drivers/pci/hotplug/rpadlpar_core.c +++ b/drivers/pci/hotplug/rpadlpar_core.c @@ -52,6 +52,7 @@ static struct device_node *find_vio_slot_node(char *drc_name) break; } + of_node_put(parent); return dn; }