diff options
| author | Krzysztof Kozlowski <krzysztof.kozlowski@oss.qualcomm.com> | 2026-01-02 13:49:34 +0100 |
|---|---|---|
| committer | Miquel Raynal <miquel.raynal@bootlin.com> | 2026-01-19 11:13:43 +0100 |
| commit | aa8cb72c2018c72b9c2fe5a8e55d530db3bc757e (patch) | |
| tree | 0416be2ebe0fb12e8ab24431787e233f68845747 | |
| parent | 8f51b6be269746d9a6abff4a5abc8b7aa680c659 (diff) | |
mtd: spi-nor: hisi-sfc: Simplify with scoped for each OF child loop
Use scoped for-each loop when iterating over device nodes to make code a
bit simpler.
Signed-off-by: Krzysztof Kozlowski <krzysztof.kozlowski@oss.qualcomm.com>
Acked-by: Pratyush Yadav <pratyush@kernel.org>
Signed-off-by: Miquel Raynal <miquel.raynal@bootlin.com>
| -rw-r--r-- | drivers/mtd/spi-nor/controllers/hisi-sfc.c | 7 |
1 files 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"); |
