Skip to content

Commit c57ba40

Browse files
krzklag-linaro
authored andcommitted
leds: bcm6358: 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 6a1d796 commit c57ba40

File tree

1 file changed

+2
-5
lines changed

1 file changed

+2
-5
lines changed

drivers/leds/leds-bcm6358.c

Lines changed: 2 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -147,7 +147,6 @@ static int bcm6358_leds_probe(struct platform_device *pdev)
147147
{
148148
struct device *dev = &pdev->dev;
149149
struct device_node *np = dev_of_node(&pdev->dev);
150-
struct device_node *child;
151150
void __iomem *mem;
152151
spinlock_t *lock; /* memory lock */
153152
unsigned long val;
@@ -184,7 +183,7 @@ static int bcm6358_leds_probe(struct platform_device *pdev)
184183
}
185184
bcm6358_led_write(mem + BCM6358_REG_CTRL, val);
186185

187-
for_each_available_child_of_node(np, child) {
186+
for_each_available_child_of_node_scoped(np, child) {
188187
int rc;
189188
u32 reg;
190189

@@ -198,10 +197,8 @@ static int bcm6358_leds_probe(struct platform_device *pdev)
198197
}
199198

200199
rc = bcm6358_led(dev, child, reg, mem, lock);
201-
if (rc < 0) {
202-
of_node_put(child);
200+
if (rc < 0)
203201
return rc;
204-
}
205202
}
206203

207204
return 0;

0 commit comments

Comments
 (0)