Received: by 2002:ac0:aed5:0:0:0:0:0 with SMTP id t21csp124258imb; Thu, 28 Feb 2019 18:13:24 -0800 (PST) X-Google-Smtp-Source: AHgI3IZfT63CR5dsvoWCoz2mvAfQ3tQn5XJFWNboD5doH8ESO+yP6dy8yJxfKO+seWhn4ZZY2Rzv X-Received: by 2002:a62:20c9:: with SMTP id m70mr2953620pfj.118.1551406404127; Thu, 28 Feb 2019 18:13:24 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1551406404; cv=none; d=google.com; s=arc-20160816; b=GTU5O5T0tVX47M/zMB1ogwVDK64nt/ctshTgyAj0Bh4OgiF/+GwAH9nGbONJ2VV3VJ Ae8P5udUGro+IhpCzKx3fgFG+eev7mIebnW5l40qrimKxtgkNV65rQte8dlHV9AwCzgJ sImqN9UMq9ktTWkFrrq+rCF7uahu9T+nxtq26q4n4UQR60jGKvdAnSRrKKIYM4sbeRJY Wn7wLUECw0nQGdOV3mMJXMCergpRzYjeNeT8lLYkoKlw3iE6G60PRQukv3IQ7VcUJ6yc i0PkZQW230v295WMmntzFeOt1qVvjsRMu2rxgep9TTdIclDO8UtPstrjmpvE5jH5Iz8I 50lg== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:mime-version:content-transfer-encoding :references:in-reply-to:date:cc:to:from:subject:message-id; bh=TPYOZIS5Ts50qWajrEZxX0FDFcAmI4FOm8CcDLA3yQ8=; b=d4DzIqQJE94Q848IrekN8yWBmMJxjyAze+wcNq1TqpkQVzMHMwb1s/cPqZpeKuYjY8 ciBbYwtUTnKEEkjC5B237eyKovTu6zeuOeOhrVuZNjfeyS1W/q2ZcMsPv1YAvNKc8/j6 k+pmIzk0pgafYVy6mVodfzffSz2D4CCiJpjb4d2+1a7KJGLrmPaHWOOPHIL8/ReX9WDQ byP68VfGuFNoPfWLGoCwcj8zdSpUxX9Dn+156gtZ9BrGtd0BQF+n57DXDtJZ+/lObi9G wIVgNwd00y8mejKX7T2bfuwieXbTnCjr5w62F3FKz0Tu8G07MacrAqWkVjgUC0yXC1Mb +JtQ== 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 w8si7508413pgl.587.2019.02.28.18.13.08; Thu, 28 Feb 2019 18:13:24 -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 S1731269AbfCAB7X (ORCPT + 99 others); Thu, 28 Feb 2019 20:59:23 -0500 Received: from mailgw01.mediatek.com ([210.61.82.183]:53803 "EHLO mailgw01.mediatek.com" rhost-flags-OK-FAIL-OK-FAIL) by vger.kernel.org with ESMTP id S1725967AbfCAB7X (ORCPT ); Thu, 28 Feb 2019 20:59:23 -0500 X-UUID: 21cdcab5909a4bec87ce57119ebaf975-20190301 X-UUID: 21cdcab5909a4bec87ce57119ebaf975-20190301 Received: from mtkcas08.mediatek.inc [(172.21.101.126)] by mailgw01.mediatek.com (envelope-from ) (mhqrelay.mediatek.com ESMTP with TLS) with ESMTP id 699210403; Fri, 01 Mar 2019 09: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 CC: , , , , , , , , , , , , , , , , , , , , , , , , , , , 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> Content-Type: text/plain; charset="UTF-8" X-Mailer: Evolution 3.2.3-0ubuntu6 Content-Transfer-Encoding: 7bit MIME-Version: 1.0 X-MTK: N Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.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