From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-7.0 required=3.0 tests=DKIMWL_WL_HIGH,DKIM_SIGNED, DKIM_VALID,HEADER_FROM_DIFFERENT_DOMAINS,INCLUDES_PATCH,MAILING_LIST_MULTI, SIGNED_OFF_BY,SPF_PASS,UNPARSEABLE_RELAY,URIBL_BLOCKED autolearn=unavailable autolearn_force=no version=3.4.0 Received: from mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id 550ACC43381 for ; Fri, 1 Mar 2019 01:59:33 +0000 (UTC) Received: from bombadil.infradead.org (bombadil.infradead.org [198.137.202.133]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.kernel.org (Postfix) with ESMTPS id 2091920842 for ; Fri, 1 Mar 2019 01:59:33 +0000 (UTC) Authentication-Results: mail.kernel.org; dkim=pass (2048-bit key) header.d=lists.infradead.org header.i=@lists.infradead.org header.b="LdWY8uuG" DMARC-Filter: OpenDMARC Filter v1.3.2 mail.kernel.org 2091920842 Authentication-Results: mail.kernel.org; dmarc=none (p=none dis=none) header.from=mediatek.com Authentication-Results: mail.kernel.org; spf=none smtp.mailfrom=linux-arm-kernel-bounces+infradead-linux-arm-kernel=archiver.kernel.org@lists.infradead.org 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:Cc:List-Subscribe:List-Help:List-Post: List-Archive:List-Unsubscribe:List-Id:MIME-Version:References:In-Reply-To: Date:To:From:Subject:Message-ID:Reply-To:Content-ID:Content-Description: Resent-Date:Resent-From:Resent-Sender:Resent-To:Resent-Cc:Resent-Message-ID: List-Owner; bh=BXw6GZYVxGMVdq47+KS2ergaZulEV7cBdPH6CEEDThQ=; b=LdWY8uuGhf/YvO hoB4Pm5ZcCBIc+Sqikg3R3tEoX4NnFmKZw0VwXWSI6g6jpBTTU/CAmvyVPwrnx7VU85MI5P2fXxP2 DLTrHjhRZd+2mZKp/upF4PyB3zMspJh03oOkpelTzNArWDAv7ormRjsg3+gG4Y1fYYzQmVPZYSncs sFWuJFCiMhQ/pfcH/bTVu6jUcO0JFLHaF1XYeLiOT3qB1tubSjhU3wM7bRZNzgy+nfqBdV2sG64+Z K83hSBZvYF/Fk2GkhG9Io7nylY3CllbC+5yrVrzAG+aV+pgWk1vsV9W4p0l/6qRohanHPcGS8FWy9 U2YK0zF/iaGFZuFsmovw==; 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 1gzXST-0004nP-Ax; Fri, 01 Mar 2019 01:59:29 +0000 Received: from mailgw01.mediatek.com ([216.200.240.184]) by bombadil.infradead.org with esmtps (Exim 4.90_1 #2 (Red Hat Linux)) id 1gzXSN-0004lu-Qm; Fri, 01 Mar 2019 01:59:26 +0000 X-UUID: f04f7379ae8741069bcb1cb3d0d86380-20190228 X-UUID: f04f7379ae8741069bcb1cb3d0d86380-20190228 Received: from mtkcas68.mediatek.inc [(172.29.94.19)] by mailgw01.mediatek.com (envelope-from ) (musrelay.mediatek.com ESMTP with TLS) with ESMTP id 618915985; Thu, 28 Feb 2019 17:59:19 -0800 Received: from mtkmbs08n1.mediatek.inc (172.21.101.55) by MTKMBS62N1.mediatek.inc (172.29.193.41) with Microsoft SMTP Server (TLS) id 15.0.1395.4; Thu, 28 Feb 2019 17:59:17 -0800 Received: from MTKCAS32.mediatek.inc (172.27.4.184) by mtkmbs08n1.mediatek.inc (172.21.101.55) with Microsoft SMTP Server (TLS) id 15.0.1395.4; Fri, 1 Mar 2019 09:59:15 +0800 Received: from [10.17.3.153] (172.27.4.253) by MTKCAS32.mediatek.inc (172.27.4.170) with Microsoft SMTP Server id 15.0.1395.4 via Frontend Transport; Fri, 1 Mar 2019 09:59:14 +0800 Message-ID: <1551405554.32061.19.camel@mhfsdcap03> Subject: Re: [PATCH 7/8] PCI: mediatek: fix a leaked reference by adding missing of_node_put From: Honghui Zhang To: Wen Yang Date: Fri, 1 Mar 2019 09:59:14 +0800 In-Reply-To: <1551242443-27300-7-git-send-email-wen.yang99@zte.com.cn> References: <1551242443-27300-1-git-send-email-wen.yang99@zte.com.cn> <1551242443-27300-7-git-send-email-wen.yang99@zte.com.cn> X-Mailer: Evolution 3.2.3-0ubuntu6 MIME-Version: 1.0 X-MTK: N X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20190228_175924_774826_42BD0D3A X-CRM114-Status: GOOD ( 15.13 ) X-BeenThere: linux-arm-kernel@lists.infradead.org X-Mailman-Version: 2.1.21 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: heiko@sntech.de, hayashi.kunihiko@socionext.com, benh@kernel.crashing.org, shawn.lin@rock-chips.com, minghuan.Lian@nxp.com, paulus@samba.org, thomas.petazzoni@bootlin.com, 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, linux-pci@vger.kernel.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 Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: 7bit Sender: "linux-arm-kernel" Errors-To: linux-arm-kernel-bounces+infradead-linux-arm-kernel=archiver.kernel.org@lists.infradead.org On Wed, 2019-02-27 at 12:40 +0800, Wen Yang wrote: > 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 > --- > 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; Thanks for fix this. Acked-by: Honghui Zhang _______________________________________________ linux-arm-kernel mailing list linux-arm-kernel@lists.infradead.org http://lists.infradead.org/mailman/listinfo/linux-arm-kernel