Linux kernel mirror (for testing) git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
kernel os linux
1
fork

Configure Feed

Select the types of activity you want to include in your feed.

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>

authored by

Krzysztof Kozlowski and committed by
Miquel Raynal
aa8cb72c 8f51b6be

+2 -5
+2 -5
drivers/mtd/spi-nor/controllers/hisi-sfc.c
··· 394 394 static int hisi_spi_nor_register_all(struct hifmc_host *host) 395 395 { 396 396 struct device *dev = host->dev; 397 - struct device_node *np; 398 397 int ret; 399 398 400 - for_each_available_child_of_node(dev->of_node, np) { 399 + for_each_available_child_of_node_scoped(dev->of_node, np) { 401 400 ret = hisi_spi_nor_register(np, host); 402 - if (ret) { 403 - of_node_put(np); 401 + if (ret) 404 402 goto fail; 405 - } 406 403 407 404 if (host->num_chip == HIFMC_MAX_CHIP_NUM) { 408 405 dev_warn(dev, "Flash device number exceeds the maximum chipselect number\n");