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 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 smtp.lore.kernel.org (Postfix) with ESMTPS id 3C20EC52D7D for ; Thu, 15 Aug 2024 07:23:24 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=lists.infradead.org; s=bombadil.20210309; h=Sender:List-Subscribe:List-Help :List-Post:List-Archive:List-Unsubscribe:List-Id:In-Reply-To:Content-Type: MIME-Version:References:Message-ID:Subject:Cc:To:From:Date:Reply-To: Content-Transfer-Encoding:Content-ID:Content-Description:Resent-Date: Resent-From:Resent-Sender:Resent-To:Resent-Cc:Resent-Message-ID:List-Owner; bh=ZPQgXt+/K8hdVrtKvDp/K2jbzvYRDCrHGMGcHAQLofc=; b=I53h72QIcVzRaJqB50HT0EX7vD GJseDAX2+j6+E+ydwAUuExoeS4o4L/fVVvN8YmU+otlm6COmkGEHZWKGvZpXZkpiVgluAIYRsMCXH KYJg+SR8O01WGJAnu5w6fG2QY0I5+njBKQBBG0wfndXTopFB4nGoTbbCPnlWHdQ8R0Kt5sQcVLuWx TpH+jmR0Azl0l7vTc4fo2OOJ8aUPO9P8W2cJLeSoh8oAOvg3s0DnuKTCHn9V/tSJLMejWI8Pp4a3j 3Ghs8pzLXM0L+nfi2DpTK6HB2GDLIoD/t27vyQzHoTEiOP474OICsieI1j1Mf6/0byw4t/Wk664eY 699rmJDg==; Received: from localhost ([::1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.97.1 #2 (Red Hat Linux)) id 1seUpH-00000009GZr-37tn; Thu, 15 Aug 2024 07:23:15 +0000 Received: from mail-pg1-x532.google.com ([2607:f8b0:4864:20::532]) by bombadil.infradead.org with esmtps (Exim 4.97.1 #2 (Red Hat Linux)) id 1seUod-00000009GUG-2fjc for linux-arm-kernel@lists.infradead.org; Thu, 15 Aug 2024 07:22:36 +0000 Received: by mail-pg1-x532.google.com with SMTP id 41be03b00d2f7-7a1c7857a49so519521a12.1 for ; Thu, 15 Aug 2024 00:22:35 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=chromium.org; s=google; t=1723706555; x=1724311355; darn=lists.infradead.org; h=in-reply-to:content-disposition:mime-version:references:message-id :subject:cc:to:from:date:from:to:cc:subject:date:message-id:reply-to; bh=ZPQgXt+/K8hdVrtKvDp/K2jbzvYRDCrHGMGcHAQLofc=; b=a5xcbgBRXf6y5Qtu72YMkGP1vvB1EWKMG7RvDM6nTLM3KpL2q5wZqSa6ba4FXfKikH 0UZpPGC/09UH1yJoHVXr9Jcvw83Ryn1/QVsFMg8RHrmGlyYEY6o44e8i4A0jnYlOz3ia y/LTpaGGiORzyMSS4CiFteXxQGcp8XU/QF7qE= X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1723706555; x=1724311355; h=in-reply-to:content-disposition:mime-version:references:message-id :subject:cc:to:from:date:x-gm-message-state:from:to:cc:subject:date :message-id:reply-to; bh=ZPQgXt+/K8hdVrtKvDp/K2jbzvYRDCrHGMGcHAQLofc=; b=HIsS3GSN6yyaVmlD/5AVskYTs++hvTC6PhoBGnn95MbXy6GvBYJjOY+IBBo8GwF8Xz Zpf2BDONauctL+X9ViOHYUcIYqNolSk9N/6Frw8mV08/Lg4u3wUxbNcWIw8PcfGFBYz3 c+Ut9GO744qvmZopkgQdZbkXRXEYQHMgAwufRj9pMo68oDpJCBos1Khee4hv81AKdw1k 2fO9V5sGXdmg35agr5XNsVbzkDTKTqkJXWl3wrh5rKuQtLOexB80bPGPLNpKsKcRYfEn XsyTsxS4f+XHsNTHuBghVp/4DMsTxvgclZTndF1CNyWj8RM/aZLWu0xEf2IMFR+RCJWo LcNA== X-Forwarded-Encrypted: i=1; AJvYcCXu5LgTyvA32qYkmUFPDFVSzEESD6PXtOWfzKgMYzlgcxhoOVq1mCGccAuIeHOUljjgyKC9nUtMoww0li4cM6epDDM7+jS9CgzvT7c/fmzUxS1zpoU= X-Gm-Message-State: AOJu0YxkKijG3eLVoshP/LktM9M2gsT3rl5eDzUwP1IK6at1POy8O1A/ kaQRCe9FVMl+3jUrg+30PY0XxAzK/dNAbWMipFA1Y8CH1GkXfQBFEoPflNZUAA== X-Google-Smtp-Source: AGHT+IF/aGc6hHkocmjJlKEUqA+vIlBn3QfPHZ/jI+SDNYKCem3sbWEWjaXISqMqkijXU5e/Tig7ew== X-Received: by 2002:a17:90a:b392:b0:2c9:359c:b0c with SMTP id 98e67ed59e1d1-2d3aab60a01mr5682803a91.28.1723706554713; Thu, 15 Aug 2024 00:22:34 -0700 (PDT) Received: from google.com ([2401:fa00:1:10:745d:58f7:b3cd:901f]) by smtp.gmail.com with ESMTPSA id 98e67ed59e1d1-2d3ac7dd457sm2930469a91.21.2024.08.15.00.22.31 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 15 Aug 2024 00:22:34 -0700 (PDT) Date: Thu, 15 Aug 2024 15:22:29 +0800 From: Chen-Yu Tsai To: Krzysztof Kozlowski Cc: "Rafael J. Wysocki" , Daniel Lezcano , Zhang Rui , Lukasz Luba , Amit Kucheria , Thara Gopinath , Thierry Reding , Jonathan Hunter , Vasily Khoruzhick , Yangtao Li , Chen-Yu Tsai , Jernej Skrabec , Samuel Holland , linux-pm@vger.kernel.org, linux-kernel@vger.kernel.org, linux-arm-msm@vger.kernel.org, linux-tegra@vger.kernel.org, linux-arm-kernel@lists.infradead.org, linux-sunxi@lists.linux.dev Subject: Re: [PATCH 4/7] thermal: of: Simplify thermal_of_for_each_cooling_maps() with scoped for each OF child loop Message-ID: <20240815072229.GD350960@google.com> References: <20240814-b4-cleanup-h-of-node-put-thermal-v1-0-7a1381e1627e@linaro.org> <20240814-b4-cleanup-h-of-node-put-thermal-v1-4-7a1381e1627e@linaro.org> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <20240814-b4-cleanup-h-of-node-put-thermal-v1-4-7a1381e1627e@linaro.org> X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20240815_002235_696264_283BFD85 X-CRM114-Status: GOOD ( 20.05 ) X-BeenThere: linux-arm-kernel@lists.infradead.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Sender: "linux-arm-kernel" Errors-To: linux-arm-kernel-bounces+linux-arm-kernel=archiver.kernel.org@lists.infradead.org On Wed, Aug 14, 2024 at 10:17:50PM +0200, Krzysztof Kozlowski wrote: > Use scoped for_each_child_of_node_scoped() when iterating over device > nodes to make code a bit simpler. > > Signed-off-by: Krzysztof Kozlowski Reviewed-by: Chen-Yu Tsai > --- > drivers/thermal/thermal_of.c | 8 +++----- > 1 file changed, 3 insertions(+), 5 deletions(-) > > diff --git a/drivers/thermal/thermal_of.c b/drivers/thermal/thermal_of.c > index fb5472d6ffea..d277165746d5 100644 > --- a/drivers/thermal/thermal_of.c > +++ b/drivers/thermal/thermal_of.c > @@ -375,7 +375,7 @@ static int thermal_of_for_each_cooling_maps(struct thermal_zone_device *tz, > int (*action)(struct device_node *, int, int, > struct thermal_zone_device *, struct thermal_cooling_device *)) > { > - struct device_node *tz_np, *cm_np, *child; > + struct device_node *tz_np, *cm_np; Looks like the remaining two pointers are also candidates for cleanup? > int ret = 0; > > tz_np = thermal_of_zone_get_by_name(tz); > @@ -388,12 +388,10 @@ static int thermal_of_for_each_cooling_maps(struct thermal_zone_device *tz, > if (!cm_np) > goto out; > > - for_each_child_of_node(cm_np, child) { > + for_each_child_of_node_scoped(cm_np, child) { > ret = thermal_of_for_each_cooling_device(tz_np, child, tz, cdev, action); > - if (ret) { > - of_node_put(child); > + if (ret) > break; > - } > } > > of_node_put(cm_np); > > -- > 2.43.0 >