Received: by 2002:ac0:8845:0:0:0:0:0 with SMTP id g63csp1369711img; Tue, 26 Feb 2019 20:41:23 -0800 (PST) X-Google-Smtp-Source: AHgI3IYm4Gj4sMdhCS1iJ0NkFAKEJUQP+/zHNk0nEXaQp67Zz1gYnFx0fjMUB4Msa41gfWv7pwmN X-Received: by 2002:a63:29c3:: with SMTP id p186mr1146570pgp.24.1551242483143; Tue, 26 Feb 2019 20:41:23 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1551242483; cv=none; d=google.com; s=arc-20160816; b=hqI1QGLxz7Y3Kulx5gSA7C8wdrkr7gA9136knJ6NLz+e9sj0wbl5OV47amK4E2iucl fK54BWJzUn/+8eqW9wA6c9Bdhrvr9bfCLyq4kmMFeE72pOHXEOKyEsx+U+eSWUEGO175 VEPWYSMhKtWV/rZSx5E5oYarXEcFefmLqxYUs65E/a3DwaIh8rHwaW/i5JCgRYSU9Hjs 38Sb+gtWyd0vOATK21NBnKyIwrWeqQIIWc8L46RStiqL/omc80b9ahVMXumPtU9q6kxH ouFM0vV4zpvvym6wTgr3a55vb0DkeTyqGuWZi6FU6zINZHlRRcZhKkLNHOZINoxuL/66 8ksA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:message-id:date:subject:cc:to:from; bh=MmAlm5QNk+vS/r3Kcx6yNRu+VVsK1ZfcswFyoVgBj3I=; b=Fv/wIF8QQ43+O02ZY2vX4LKMFBtcZPNJIM4jZiYsw1RO1gNZN4u9Bo35Ixi661YHlJ 3qxnxoaCnuuvJX77nlJcYFOOVp+L08Zng0IaNJ+ymI99dfh+QCqeK6ZNacrGo0rh/MD8 ufJK3Pau833AU7eRTPJtHox3hT4giDNb6Z/vT//+zfUS7nImCkQf8FPgTde6CxlhnBFx fR2qdzkKyQuRP4rpqDhWZH+owxVQX7ryRXhfr48YMRemkQv5zh5rGex9SwWOjRYUvKVd 6IMeEFO4vmGmbDw/+3ZUjswvfU2ixw6XK5Xf40pbzWjMRuSVXO7Ra9Z/t/puoXz9/dJf mODw== ARC-Authentication-Results: i=1; mx.google.com; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id 91si14234730plb.265.2019.02.26.20.41.07; Tue, 26 Feb 2019 20:41:23 -0800 (PST) Received-SPF: pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) client-ip=209.132.180.67; Authentication-Results: mx.google.com; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1729560AbfB0Ekm (ORCPT + 99 others); Tue, 26 Feb 2019 23:40:42 -0500 Received: from mxhk.zte.com.cn ([63.217.80.70]:44054 "EHLO mxhk.zte.com.cn" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1729265AbfB0Ekm (ORCPT ); Tue, 26 Feb 2019 23:40:42 -0500 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 Cc: paulus@samba.org, mpe@ellerman.id.au, tyreld@linux.vnet.ibm.com, bhelgaas@google.com, linuxppc-dev@lists.ozlabs.org, linux-pci@vger.kernel.org, linux-kernel@vger.kernel.org, ryder.lee@mediatek.com, lorenzo.pieralisi@arm.com, matthias.bgg@gmail.com, linux-mediatek@lists.infradead.org, linux-arm-kernel@lists.infradead.org, rjui@broadcom.com, sbranden@broadcom.com, bcm-kernel-feedback-list@broadcom.com, thomas.petazzoni@bootlin.com, shawn.lin@rock-chips.com, heiko@sntech.de, linux-rockchip@lists.infradead.org, minghuan.Lian@nxp.com, mingkai.hu@nxp.com, roy.zang@nxp.com, hayashi.kunihiko@socionext.com, yamada.masahiro@socionext.com, kishon@ti.com, linux-omap@vger.kernel.org, wang.yi59@zte.com.cn, Wen Yang 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 Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org 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; -- 2.9.5