Skip to content

Commit 6a1d796

Browse files
krzklag-linaro
authored andcommitted
leds: bcm6328: Simplify with scoped for each OF child loop
Use scoped for_each_available_child_of_node_scoped() when iterating over device nodes to make code a bit simpler. Signed-off-by: Krzysztof Kozlowski <[email protected]> Link: https://lore.kernel.org/r/[email protected] Signed-off-by: Lee Jones <[email protected]>
1 parent 073f016 commit 6a1d796

File tree

1 file changed

+2
-5
lines changed

1 file changed

+2
-5
lines changed

drivers/leds/leds-bcm6328.c

Lines changed: 2 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -392,7 +392,6 @@ static int bcm6328_leds_probe(struct platform_device *pdev)
392392
{
393393
struct device *dev = &pdev->dev;
394394
struct device_node *np = dev_of_node(&pdev->dev);
395-
struct device_node *child;
396395
void __iomem *mem;
397396
spinlock_t *lock; /* memory lock */
398397
unsigned long val, *blink_leds, *blink_delay;
@@ -435,7 +434,7 @@ static int bcm6328_leds_probe(struct platform_device *pdev)
435434
val |= BCM6328_SERIAL_LED_SHIFT_DIR;
436435
bcm6328_led_write(mem + BCM6328_REG_INIT, val);
437436

438-
for_each_available_child_of_node(np, child) {
437+
for_each_available_child_of_node_scoped(np, child) {
439438
int rc;
440439
u32 reg;
441440

@@ -454,10 +453,8 @@ static int bcm6328_leds_probe(struct platform_device *pdev)
454453
rc = bcm6328_led(dev, child, reg, mem, lock,
455454
blink_leds, blink_delay);
456455

457-
if (rc < 0) {
458-
of_node_put(child);
456+
if (rc < 0)
459457
return rc;
460-
}
461458
}
462459

463460
return 0;

0 commit comments

Comments
 (0)