From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from frasgout.his.huawei.com (frasgout.his.huawei.com [185.176.79.56]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 47D5F30C35C; Tue, 6 Jan 2026 10:35:21 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=185.176.79.56 ARC-Seal:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1767695724; cv=none; b=MWv8lAYRy7AGkiW8Vk6jvIZosAP9j4wH8H1z0IZnG+3amHRojS/llh+JdbhGUp4zSeHlWn9y1MpFoZC3JTZbtAqABdJQuevvIXEz97rOeYBgYIlVRHvpZwS95IK9oq8F6d7LiUZkFmC0oX9M0uQ8bj+l6GrHUAy+X9XoZClOKwA= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1767695724; c=relaxed/simple; bh=HUmbLksNpU+1G4wOtInXCqWDibk5hPeW2bvgZCX6G5E=; h=Date:From:To:CC:Subject:Message-ID:In-Reply-To:References: MIME-Version:Content-Type; b=abfeew9Q53hIzWyoikuqjSW0D3ThawK0Ac336x58EYn1uaqX8S2V77qD9ZyBZPnSOitdRzKeDj8Jx2OP9q8ilHJFEk6d2IgQQDDjmd69xdp9maDwYdw10GS/kYp+zEWRVI2u0vIMvpBsqhZYr8bJtAFejASQ/Xjx14lPNJ3kxX8= ARC-Authentication-Results:i=1; smtp.subspace.kernel.org; dmarc=pass (p=quarantine dis=none) header.from=huawei.com; spf=pass smtp.mailfrom=huawei.com; arc=none smtp.client-ip=185.176.79.56 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=quarantine dis=none) header.from=huawei.com Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=huawei.com Received: from mail.maildlp.com (unknown [172.18.224.107]) by frasgout.his.huawei.com (SkyGuard) with ESMTPS id 4dlncL3gwGzHnHGw; Tue, 6 Jan 2026 18:35:14 +0800 (CST) Received: from dubpeml100005.china.huawei.com (unknown [7.214.146.113]) by mail.maildlp.com (Postfix) with ESMTPS id 7E19C40570; Tue, 6 Jan 2026 18:35:18 +0800 (CST) Received: from localhost (10.48.149.114) by dubpeml100005.china.huawei.com (7.214.146.113) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.2.1544.36; Tue, 6 Jan 2026 10:35:15 +0000 Date: Tue, 6 Jan 2026 10:35:12 +0000 From: Jonathan Cameron To: Krzysztof Kozlowski CC: Miguel Ojeda , Rob Herring , "Saravana Kannan" , Nathan Chancellor , "Nick Desaulniers" , Bill Wendling , Justin Stitt , Russell King , Nicolas Ferre , Alexandre Belloni , Claudiu Beznea , Krzysztof Kozlowski , "Alim Akhtar" , Madhavan Srinivasan , Michael Ellerman , "Nicholas Piggin" , "Christophe Leroy (CS GROUP)" , Nipun Gupta , Nikhil Agarwal , Abel Vesa , Peng Fan , Michael Turquette , "Stephen Boyd" , Shawn Guo , Sascha Hauer , Pengutronix Kernel Team , Fabio Estevam , Vinod Koul , Sylwester Nawrocki , Mauro Carvalho Chehab , "Rafael J. Wysocki" , Viresh Kumar , , , , , , , , , , , Subject: Re: [PATCH 11/11] cpufreq: s5pv210: Simplify with scoped for each OF child loop Message-ID: <20260106103512.00002266@huawei.com> In-Reply-To: <20260105-of-for-each-compatible-scoped-v1-11-24e99c177164@oss.qualcomm.com> References: <20260105-of-for-each-compatible-scoped-v1-0-24e99c177164@oss.qualcomm.com> <20260105-of-for-each-compatible-scoped-v1-11-24e99c177164@oss.qualcomm.com> X-Mailer: Claws Mail 4.3.0 (GTK 3.24.42; x86_64-w64-mingw32) Precedence: bulk X-Mailing-List: linux-media@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Type: text/plain; charset="US-ASCII" Content-Transfer-Encoding: 7bit X-ClientProxiedBy: lhrpeml100010.china.huawei.com (7.191.174.197) To dubpeml100005.china.huawei.com (7.214.146.113) On Mon, 05 Jan 2026 14:33:49 +0100 Krzysztof Kozlowski wrote: > Use scoped for-each loop when iterating over device nodes to make code a > bit simpler. Note that there is another part of code using "np" > variable, so scoped loop should not shadow it. > > Signed-off-by: Krzysztof Kozlowski Patch is fine so Reviewed-by: Jonathan Cameron Bit odd to use devm_ for a driver that has no real support for being unbound (looks like it leaks everything if that happens) but to me it looks like it might be worth doing anyway to allow direct returns in error cases etc. Anyhow, that's a much bigger looking project and would need a devm_add_action_or_reset() for the final register and someone to test it doesn't blow up if an unbind does happen. One of the things I like about reviewing this sort of cleanup series is it makes me look at a bunch of code I'd never normally go see ;) Jonathan > > --- > > Depends on the first patch. > --- > drivers/cpufreq/s5pv210-cpufreq.c | 10 ++++------ > 1 file changed, 4 insertions(+), 6 deletions(-) > > diff --git a/drivers/cpufreq/s5pv210-cpufreq.c b/drivers/cpufreq/s5pv210-cpufreq.c > index ba8a1c96427a..e64e84e1ee79 100644 > --- a/drivers/cpufreq/s5pv210-cpufreq.c > +++ b/drivers/cpufreq/s5pv210-cpufreq.c > @@ -629,19 +629,17 @@ static int s5pv210_cpufreq_probe(struct platform_device *pdev) > goto err_clock; > } > > - for_each_compatible_node(np, NULL, "samsung,s5pv210-dmc") { > - id = of_alias_get_id(np, "dmc"); > + for_each_compatible_node_scoped(dmc, NULL, "samsung,s5pv210-dmc") { > + id = of_alias_get_id(dmc, "dmc"); > if (id < 0 || id >= ARRAY_SIZE(dmc_base)) { > - dev_err(dev, "failed to get alias of dmc node '%pOFn'\n", np); > - of_node_put(np); > + dev_err(dev, "failed to get alias of dmc node '%pOFn'\n", dmc); > result = id; > goto err_clk_base; > } > > - dmc_base[id] = of_iomap(np, 0); > + dmc_base[id] = of_iomap(dmc, 0); > if (!dmc_base[id]) { > dev_err(dev, "failed to map dmc%d registers\n", id); > - of_node_put(np); > result = -EFAULT; > goto err_dmc; > } >