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: rawnand: brcm: 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>
Signed-off-by: Miquel Raynal <miquel.raynal@bootlin.com>

authored by

Krzysztof Kozlowski and committed by
Miquel Raynal
f3701ba1 6d8226cb

+4 -6
+4 -6
drivers/mtd/nand/raw/brcmnand/brcmnand.c
··· 3298 3298 { 3299 3299 struct brcmnand_platform_data *pd = dev_get_platdata(&pdev->dev); 3300 3300 struct device *dev = &pdev->dev; 3301 - struct device_node *dn = dev->of_node, *child; 3301 + struct device_node *dn = dev->of_node; 3302 3302 struct brcmnand_controller *ctrl; 3303 3303 struct brcmnand_host *host; 3304 3304 struct resource *res; ··· 3486 3486 } 3487 3487 } 3488 3488 3489 - for_each_available_child_of_node(dn, child) { 3489 + for_each_available_child_of_node_scoped(dn, child) { 3490 3490 if (of_device_is_compatible(child, "brcm,nandcs")) { 3491 3491 3492 3492 host = devm_kzalloc(dev, sizeof(*host), GFP_KERNEL); 3493 3493 if (!host) { 3494 - of_node_put(child); 3495 3494 ret = -ENOMEM; 3496 3495 goto err; 3497 3496 } ··· 3508 3509 3509 3510 ret = brcmnand_init_cs(host, NULL); 3510 3511 if (ret) { 3511 - if (ret == -EPROBE_DEFER) { 3512 - of_node_put(child); 3512 + if (ret == -EPROBE_DEFER) 3513 3513 goto err; 3514 - } 3514 + 3515 3515 devm_kfree(dev, host); 3516 3516 continue; /* Try all chip-selects */ 3517 3517 }