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 65E2B30F7FE; Tue, 6 Jan 2026 10:17:41 +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=1767694663; cv=none; b=keA7XdjJleOdCsKEsjVYq24DnIFyqDcl2gDsLi6s5hencjsKQ510Ex+/ppW87oKo8uZCjNT7nw3yRXrBmwyr+s+kRaYzFob3RQ0Rw/3hcEqLx1ThCH+qPEtBAfR86gmQ5lYb9F3udGm1ZB28Qxx3tvnDT15R+TIaIXt5FdzybI8= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1767694663; c=relaxed/simple; bh=WQ8hmn+buMgJNRJVF+xXil3IKBQiymPevLTWOD3c11s=; h=Date:From:To:CC:Subject:Message-ID:In-Reply-To:References: MIME-Version:Content-Type; b=iqaw0kUp9Pe3oyFForK9RAIitPUJIDY4TsFul7b40X5GkMCLilYKt7zjhxsC+x+o6KUXJQMkGkdxh7S4ky4itC8+pLnak2sRl7k+9uUpj9EfsB0Pc7/2GHohUEgBs66e8InE0UMG4pAKds4uDBm3mqpj0TO+i/mRqPuW5244fTc= 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.150]) by frasgout.his.huawei.com (SkyGuard) with ESMTPS id 4dlnCz32yTzHnHX4; Tue, 6 Jan 2026 18:17:35 +0800 (CST) Received: from dubpeml100005.china.huawei.com (unknown [7.214.146.113]) by mail.maildlp.com (Postfix) with ESMTPS id 5D87E4056A; Tue, 6 Jan 2026 18:17:39 +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:17:37 +0000 Date: Tue, 6 Jan 2026 10:17:33 +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 06/11] cdx: Simplify with scoped for each OF child loop Message-ID: <20260106101733.000059e9@huawei.com> In-Reply-To: <20260105-of-for-each-compatible-scoped-v1-6-24e99c177164@oss.qualcomm.com> References: <20260105-of-for-each-compatible-scoped-v1-0-24e99c177164@oss.qualcomm.com> <20260105-of-for-each-compatible-scoped-v1-6-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:44 +0100 Krzysztof Kozlowski wrote: > Use scoped for-each loop when iterating over device nodes to make code a > bit simpler. > > Signed-off-by: Krzysztof Kozlowski I'd be tempted to make one more tweak in this one to bring it inline with the suggestions around not combining scoped cleanups with gotos (see the comments in cleanup.h) No bug here, just nice to have. > > --- > > Depends on the first patch. > --- > drivers/cdx/cdx.c | 4 +--- > 1 file changed, 1 insertion(+), 3 deletions(-) > > diff --git a/drivers/cdx/cdx.c b/drivers/cdx/cdx.c > index b39af2f1937f..bbde529aaa93 100644 > --- a/drivers/cdx/cdx.c > +++ b/drivers/cdx/cdx.c > @@ -608,7 +608,6 @@ static ssize_t rescan_store(const struct bus_type *bus, > { > struct cdx_controller *cdx; > struct platform_device *pd; > - struct device_node *np; > bool val; > > if (kstrtobool(buf, &val) < 0) > @@ -623,10 +622,9 @@ static ssize_t rescan_store(const struct bus_type *bus, > cdx_unregister_devices(&cdx_bus_type); > > /* Rescan all the devices */ > - for_each_compatible_node(np, NULL, compat_node_name) { > + for_each_compatible_node_scoped(np, NULL, compat_node_name) { > pd = of_find_device_by_node(np); > if (!pd) { > - of_node_put(np); > count = -EINVAL; > goto unlock; break instead. Or better yet a follow up patch to use guard() for the mutex allowing a direct return here. > } >