[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <86a4yw87g8.fsf@kernel.org>
Date: Fri, 02 Jan 2026 14:33:59 +0100
From: Pratyush Yadav <pratyush@...nel.org>
To: Krzysztof Kozlowski <krzysztof.kozlowski@....qualcomm.com>
Cc: Brian Norris <computersforpeace@...il.com>, Kamal Dasu
<kamal.dasu@...adcom.com>, Broadcom internal kernel review list
<bcm-kernel-feedback-list@...adcom.com>, Miquel Raynal
<miquel.raynal@...tlin.com>, Richard Weinberger <richard@....at>,
Vignesh Raghavendra <vigneshr@...com>, Harvey Hunt
<harveyhuntnexus@...il.com>, Paul Cercueil <paul@...pouillou.net>,
Manivannan Sadhasivam <mani@...nel.org>, Stefan Agner <stefan@...er.ch>,
Tudor Ambarus <tudor.ambarus@...aro.org>, Pratyush Yadav
<pratyush@...nel.org>, Michael Walle <mwalle@...nel.org>, Nathan
Chancellor <nathan@...nel.org>, Nick Desaulniers
<nick.desaulniers+lkml@...il.com>, Bill Wendling <morbo@...gle.com>,
Justin Stitt <justinstitt@...gle.com>, linux-mtd@...ts.infradead.org,
linux-kernel@...r.kernel.org, linux-mips@...r.kernel.org,
linux-arm-msm@...r.kernel.org, llvm@...ts.linux.dev
Subject: Re: [PATCH 7/7] mtd: spi-nor: hisi-sfc: Simplify with scoped for
each OF child loop
Hi Kyzystof,
Thanks for the cleanup.
On Fri, Jan 02 2026, Krzysztof Kozlowski wrote:
> Use scoped for-each loop when iterating over device nodes to make code a
> bit simpler.
Nit: the commit message is a bit too dry. I had to go and look what the
difference between the two variants was. I could make an educated guess
by looking at the patch, but still.
If you end up doing a v2, a one-liner explanation of the difference
between the two loop variants would be nice to have.
Acked-by: Pratyush Yadav <pratyush@...nel.org>
>
> Signed-off-by: Krzysztof Kozlowski <krzysztof.kozlowski@....qualcomm.com>
> ---
> drivers/mtd/spi-nor/controllers/hisi-sfc.c | 7 ++-----
> 1 file changed, 2 insertions(+), 5 deletions(-)
>
> diff --git a/drivers/mtd/spi-nor/controllers/hisi-sfc.c b/drivers/mtd/spi-nor/controllers/hisi-sfc.c
> index db948da2c4c5..54c49a8423a2 100644
> --- a/drivers/mtd/spi-nor/controllers/hisi-sfc.c
> +++ b/drivers/mtd/spi-nor/controllers/hisi-sfc.c
> @@ -394,15 +394,12 @@ static void hisi_spi_nor_unregister_all(struct hifmc_host *host)
> static int hisi_spi_nor_register_all(struct hifmc_host *host)
> {
> struct device *dev = host->dev;
> - struct device_node *np;
> int ret;
>
> - for_each_available_child_of_node(dev->of_node, np) {
> + for_each_available_child_of_node_scoped(dev->of_node, np) {
> ret = hisi_spi_nor_register(np, host);
> - if (ret) {
> - of_node_put(np);
> + if (ret)
> goto fail;
> - }
>
> if (host->num_chip == HIFMC_MAX_CHIP_NUM) {
> dev_warn(dev, "Flash device number exceeds the maximum chipselect number\n");
--
Regards,
Pratyush Yadav
Powered by blists - more mailing lists