Skip to content

Commit 32960b4

Browse files
committed
memory: pl353-smc: 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. Suggested-by: Jonathan Cameron <[email protected]> Reviewed-by: Miquel Raynal <[email protected]> Link: https://lore.kernel.org/r/[email protected] Signed-off-by: Krzysztof Kozlowski <[email protected]>
1 parent 331b8a9 commit 32960b4

File tree

1 file changed

+2
-5
lines changed

1 file changed

+2
-5
lines changed

drivers/memory/pl353-smc.c

Lines changed: 2 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -74,7 +74,6 @@ static int pl353_smc_probe(struct amba_device *adev, const struct amba_id *id)
7474
struct device_node *of_node = adev->dev.of_node;
7575
const struct of_device_id *match = NULL;
7676
struct pl353_smc_data *pl353_smc;
77-
struct device_node *child;
7877

7978
pl353_smc = devm_kzalloc(&adev->dev, sizeof(*pl353_smc), GFP_KERNEL);
8079
if (!pl353_smc)
@@ -93,22 +92,20 @@ static int pl353_smc_probe(struct amba_device *adev, const struct amba_id *id)
9392
amba_set_drvdata(adev, pl353_smc);
9493

9594
/* Find compatible children. Only a single child is supported */
96-
for_each_available_child_of_node(of_node, child) {
95+
for_each_available_child_of_node_scoped(of_node, child) {
9796
match = of_match_node(pl353_smc_supported_children, child);
9897
if (!match) {
9998
dev_warn(&adev->dev, "unsupported child node\n");
10099
continue;
101100
}
101+
of_platform_device_create(child, NULL, &adev->dev);
102102
break;
103103
}
104104
if (!match) {
105105
dev_err(&adev->dev, "no matching children\n");
106106
return -ENODEV;
107107
}
108108

109-
of_platform_device_create(child, NULL, &adev->dev);
110-
of_node_put(child);
111-
112109
return 0;
113110
}
114111

0 commit comments

Comments
 (0)