Received: by 2002:ac0:a5b6:0:0:0:0:0 with SMTP id m51-v6csp3823150imm; Mon, 11 Jun 2018 02:20:09 -0700 (PDT) X-Google-Smtp-Source: ADUXVKLupeohH7/arVfha1rX7m+Oedh2OJwzNpLTZRWflEXvXVmBKmuFifGxUTPb8NaNmGVcdv4S X-Received: by 2002:a65:4249:: with SMTP id d9-v6mr14208091pgq.362.1528708809080; Mon, 11 Jun 2018 02:20:09 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1528708809; cv=none; d=google.com; s=arc-20160816; b=hB1Vjb3u16/5y5sKvwOLb7vJ067CPDrZj/jr9gRYntYtePCF84n17FQy1yWmtnAAbQ /4Ip7VfQ4gsrDFi14FmufxliVrjgPtQT4HJK+tPtwG2N63Pz1qYH7ZQaAcoMJQRl7scO J8gVdQq2O87C3VnLviyS10rPBrp3UVGQgGKpUZ3Y9p9Dek5easPA8cZC8Nh7vCu8v0AS 4kCDF6WO1IGd92JVbOubC6ehJ0zdgVf4YC3tjO66FOKAeDlYhSmjztlGckIT8AXEbKyd sVHtgmCxApjtannDlARvLMx02wGWU+lSm+mxKy7Z1L74p/xXSSjPK1LcAChPJ9wQWctT ABig== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:content-transfer-encoding :content-language:in-reply-to:mime-version:user-agent:date :message-id:from:references:cc:to:subject:arc-authentication-results; bh=pAKXAZFXoNCE8/cbMfos4xJ17QDzKQxHx8o9ToyssQ4=; b=tTcUNPMdtVABV+CAfskpZnXr0SD7hU7Kf/JCZJxUg1Trdm/HS+vIJmiC3kCjMBa+V4 w5BoQGLLdb15v1+db8IP3nXdukxFyzvRSi8G89lU4PYTNuI10M0LywoNGoP/BtcgNcci H1LH8zzZzFuA/8bTkzaSXijaa91V5DNdNI+bXJ46lltd9HSunJHVyvJRTnyI5dk3OgHa FrVhzOqggrSbW1wjHtGZTXQWouvHpjEAvnp0XdJ3ISrcGJPHQfLws+FCRZmwIZBog/ra UO+4jL0PP8V+Ucg1qyWqfGH+LyLyQ+jAXlKR/XptwrjkIU1gXzq076l10Va8HHPwKBpM EXFQ== 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 g28-v6si27551204plj.307.2018.06.11.02.19.54; Mon, 11 Jun 2018 02:20:09 -0700 (PDT) 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 S1754180AbeFKJS2 (ORCPT + 99 others); Mon, 11 Jun 2018 05:18:28 -0400 Received: from foss.arm.com ([217.140.101.70]:49062 "EHLO foss.arm.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1754010AbeFKJS0 (ORCPT ); Mon, 11 Jun 2018 05:18:26 -0400 Received: from usa-sjc-imap-foss1.foss.arm.com (unknown [10.72.51.249]) by usa-sjc-mx-foss1.foss.arm.com (Postfix) with ESMTP id 940F41435; Mon, 11 Jun 2018 02:18:26 -0700 (PDT) Received: from [10.1.206.73] (en101.cambridge.arm.com [10.1.206.73]) by usa-sjc-imap-foss1.foss.arm.com (Postfix) with ESMTPSA id 4D3003F53D; Mon, 11 Jun 2018 02:18:24 -0700 (PDT) Subject: Re: [PATCH 02/20] coresight: of: Fix refcounting for graph nodes To: Mathieu Poirier Cc: linux-arm-kernel@lists.infradead.org, robh@kernel.org, frowand.list@gmail.com, mark.rutland@arm.com, sudeep.holla@arm.com, arm@kernel.org, linux-kernel@vger.kernel.org, matt.sealey@arm.com, john.horley@arm.com, charles.garcia-tobin@arm.com, coresight@lists.linaro.org, devicetree@vger.kernel.org, mike.leach@linaro.org References: <1528235011-30691-1-git-send-email-suzuki.poulose@arm.com> <1528235011-30691-3-git-send-email-suzuki.poulose@arm.com> <20180608195530.GB30587@xps15> From: Suzuki K Poulose Message-ID: Date: Mon, 11 Jun 2018 10:18:22 +0100 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:52.0) Gecko/20100101 Thunderbird/52.8.0 MIME-Version: 1.0 In-Reply-To: <20180608195530.GB30587@xps15> Content-Type: text/plain; charset=us-ascii; format=flowed Content-Language: en-US Content-Transfer-Encoding: 7bit Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On 08/06/18 20:55, Mathieu Poirier wrote: > On Tue, Jun 05, 2018 at 10:43:13PM +0100, Suzuki K Poulose wrote: >> The coresight driver doesn't drop the references on the >> remote endpoint/port nodes. Add the missing of_node_put() >> calls. To make it easier to handle different corner cases >> cleanly, move the parsing of an endpoint to separate >> function. > > Please split this as those are two different things. Mathieu, I can do that, its only that if someone were to backport the fix for an older kernel, they would need to pick up these two patches, which is still fine. > >> >> Reported-by: Mathieu Poirier >> Signed-off-by: Suzuki K Poulose >> --- >> drivers/hwtracing/coresight/of_coresight.c | 139 +++++++++++++++++------------ >> 1 file changed, 84 insertions(+), 55 deletions(-) >> >> diff --git a/drivers/hwtracing/coresight/of_coresight.c b/drivers/hwtracing/coresight/of_coresight.c >> index a33a92e..8a23c63 100644 >> --- a/drivers/hwtracing/coresight/of_coresight.c >> +++ b/drivers/hwtracing/coresight/of_coresight.c >> +static int of_coresight_parse_endpoint(struct device_node *ep, >> + struct coresight_platform_data *pdata, >> + int *i) >> +{ >> + int ret = 0; >> + struct of_endpoint endpoint, rendpoint; >> + struct device_node *rparent = NULL; >> + struct device_node *rport = NULL; >> + struct device *rdev = NULL; >> + >> + do { ... >> + } while (0); > > That's a clever way of coding a classic 'goto' block. > >> + >> + if (rparent) >> + of_node_put(rparent); >> + if (rport) >> + of_node_put(rport); > > Perfect - thank you for that. > >> pdata->name = dev_name(dev); >> + pdata->cpu = of_coresight_get_cpu(node); >> >> /* Get the number of input and output port for this component */ >> of_coresight_get_ports(node, &pdata->nr_inport, &pdata->nr_outport); >> >> - if (pdata->nr_outport) { >> - ret = of_coresight_alloc_memory(dev, pdata); >> + /* If there are not output connections, we are done */ > > /not/no Thanks for spotting. Suzuki