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 4EA59C3DA7F for ; Thu, 15 Aug 2024 07:30:37 +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=EwP1Gv/Yx/xpl+pnVih7/w3vpScHL1lhIFF+Jyhxw7M=; b=Cc/R9uqwDiqsMlE2DaXzfd75ag kVkI8bplDHoXi+Ky/wnK7mpYK15nem1dbPTjHJa1JbLVZmCkBG4AE7BB84Gdvax8+U/w9/A2xSr4q p9/AOz1ckexebrncGzAZ0Me1gtUhjsZr3pZqhGW7M5wtunHyimL9mgqTL7HRzSl4adzmgmmRqLHIr OR9diA15fSOGtEDtmKG1D2PmpAMpqSjT67Uc22+cVG3UPJ7umyBdjvO2g1fu12sh5DgYPvLLkXHGx WWUzSJFrPHilLvMZYakmTtHoLAtFi5S1dvQYzCnHefjEGaf/mq8JwEJE+rFkfdKDWgOj2y420SNbZ HtTV4H3Q==; Received: from localhost ([::1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.97.1 #2 (Red Hat Linux)) id 1seUwF-00000009HYm-1aIJ; Thu, 15 Aug 2024 07:30:27 +0000 Received: from mail-oi1-x231.google.com ([2607:f8b0:4864:20::231]) by bombadil.infradead.org with esmtps (Exim 4.97.1 #2 (Red Hat Linux)) id 1seUvZ-00000009HMx-2ojx for linux-arm-kernel@lists.infradead.org; Thu, 15 Aug 2024 07:29:47 +0000 Received: by mail-oi1-x231.google.com with SMTP id 5614622812f47-3db16a98d16so386123b6e.0 for ; Thu, 15 Aug 2024 00:29:45 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=chromium.org; s=google; t=1723706984; x=1724311784; 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=EwP1Gv/Yx/xpl+pnVih7/w3vpScHL1lhIFF+Jyhxw7M=; b=TSz/kTdCiE0cfz+ZkGVCZDCLhvM/BMJmEOY1r4B2CwG0gi2ExGQbyeGSskBljGU1OY 6LLuLIe+7b+adOD6JBHpGvrpx/m3x8hDqXobsQWXs1PfETRlo7ESpmH7gguZ/SxxcUPL 2Imq+gv79C4BMeCCPE77Qxp16Hd/4jFW+lm08= X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1723706984; x=1724311784; 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=EwP1Gv/Yx/xpl+pnVih7/w3vpScHL1lhIFF+Jyhxw7M=; b=pMD9who+Dh3pd9NhyRtmNFFEoFPAF8oqbR6YQLGqI/Lgxi81US/yEDZBdOAjfo0CeX PGAsXP3fUPU/+gQiKifEpX2vh3h09HuCB0/VYAwKa1JAG1JMmTHglwVVVzBONmOJxOvg YTjrYb5yFOPzVURShFou8znYYcm/sMAEPhDH7rLxuGWHas4OZwAAcCbAnRl2+itTi5b3 JeixBqzzkUT10q/od3Z1D4QhEZrJcdVeCRTbar6HDvM0iH7uE7f7zaKgHU/+wXTdNg9u dgYw3CDBqjKP27/TSC1siGFVhSM9VuovkCok9enSCfKYlEynKDFbgaECqb950npG350k 9Xcg== X-Forwarded-Encrypted: i=1; AJvYcCWesbhf8mL0xjVBXQEF4O8fPApSgV9zWS6eRKY6Q9kHCo4EcwiPufs7wa+a5yYhnIaTeUtnYJE81hdUsqnksRwhjVL8Fbk0TbISY4LSJXwO4g9zn6I= X-Gm-Message-State: AOJu0Yx3QJe71otpTGRvzsyBahV2ZAXvlywoO5NdRHgvIxrEYWF+lLdT BBo+3x6qA44vELdnP8yUiKFt7HAXHUm3wMFEC6Q4TiYIU/ESKqLt8vcF+HEn5Q== X-Google-Smtp-Source: AGHT+IGmv5LKc/rdRpi8Ra9/RsIMunAWATmlN37PMZ/4ZdYVF8yC6fAOhJyK+4vfrUac1BNWQewwDg== X-Received: by 2002:a05:6808:1821:b0:3da:aae9:717b with SMTP id 5614622812f47-3dd299929c7mr6326564b6e.45.1723706984412; Thu, 15 Aug 2024 00:29:44 -0700 (PDT) Received: from google.com ([2401:fa00:1:10:745d:58f7:b3cd:901f]) by smtp.gmail.com with ESMTPSA id 41be03b00d2f7-7c6b61a6d98sm524661a12.11.2024.08.15.00.29.40 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 15 Aug 2024 00:29:43 -0700 (PDT) Date: Thu, 15 Aug 2024 15:29:38 +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 5/7] thermal: qcom-spmi-adc-tm5: Simplify with scoped for each OF child loop Message-ID: <20240815072938.GE350960@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-5-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-5-7a1381e1627e@linaro.org> X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20240815_002945_755171_35661ADE X-CRM114-Status: GOOD ( 19.62 ) 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:51PM +0200, Krzysztof Kozlowski wrote: > Use scoped for_each_available_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/qcom/qcom-spmi-adc-tm5.c | 7 ++----- > 1 file changed, 2 insertions(+), 5 deletions(-) > > diff --git a/drivers/thermal/qcom/qcom-spmi-adc-tm5.c b/drivers/thermal/qcom/qcom-spmi-adc-tm5.c > index 7c9f4023babc..19cdb98c310e 100644 > --- a/drivers/thermal/qcom/qcom-spmi-adc-tm5.c > +++ b/drivers/thermal/qcom/qcom-spmi-adc-tm5.c > @@ -938,7 +938,6 @@ static const struct adc_tm5_data adc_tm5_gen2_data_pmic = { > static int adc_tm5_get_dt_data(struct adc_tm5_chip *adc_tm, struct device_node *node) > { > struct adc_tm5_channel *channels; > - struct device_node *child; > u32 value; > int ret; > struct device *dev = adc_tm->dev; > @@ -982,12 +981,10 @@ static int adc_tm5_get_dt_data(struct adc_tm5_chip *adc_tm, struct device_node * > adc_tm->avg_samples = VADC_DEF_AVG_SAMPLES; > } > > - for_each_available_child_of_node(node, child) { > + for_each_available_child_of_node_scoped(node, child) { > ret = adc_tm5_get_dt_channel_data(adc_tm, channels, child); > - if (ret) { > - of_node_put(child); > + if (ret) > return ret; > - } > > channels++; > } > > -- > 2.43.0 >