summaryrefslogtreecommitdiff
path: root/drivers/memory
diff options
context:
space:
mode:
authorKrzysztof Kozlowski <krzysztof.kozlowski@linaro.org>2024-08-25 15:50:01 +0200
committerKrzysztof Kozlowski <krzysztof.kozlowski@linaro.org>2024-08-31 07:44:24 +0200
commit32960b4f25c248f13758b8bbe6cc4260828442a1 (patch)
tree1c66055ce362130c2c96418832b8591a2b686156 /drivers/memory
parent331b8a963137d182248599d500edd9b4a3783db5 (diff)
downloadlwn-32960b4f25c248f13758b8bbe6cc4260828442a1.tar.gz
lwn-32960b4f25c248f13758b8bbe6cc4260828442a1.zip
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 <Jonathan.Cameron@Huawei.com> Reviewed-by: Miquel Raynal <miquel.raynal@bootlin.com> Link: https://lore.kernel.org/r/20240825135001.48963-2-krzysztof.kozlowski@linaro.org Signed-off-by: Krzysztof Kozlowski <krzysztof.kozlowski@linaro.org>
Diffstat (limited to 'drivers/memory')
-rw-r--r--drivers/memory/pl353-smc.c7
1 files changed, 2 insertions, 5 deletions
diff --git a/drivers/memory/pl353-smc.c b/drivers/memory/pl353-smc.c
index 994c7a792e34..28a8cc56003c 100644
--- a/drivers/memory/pl353-smc.c
+++ b/drivers/memory/pl353-smc.c
@@ -74,7 +74,6 @@ static int pl353_smc_probe(struct amba_device *adev, const struct amba_id *id)
struct device_node *of_node = adev->dev.of_node;
const struct of_device_id *match = NULL;
struct pl353_smc_data *pl353_smc;
- struct device_node *child;
pl353_smc = devm_kzalloc(&adev->dev, sizeof(*pl353_smc), GFP_KERNEL);
if (!pl353_smc)
@@ -93,12 +92,13 @@ static int pl353_smc_probe(struct amba_device *adev, const struct amba_id *id)
amba_set_drvdata(adev, pl353_smc);
/* Find compatible children. Only a single child is supported */
- for_each_available_child_of_node(of_node, child) {
+ for_each_available_child_of_node_scoped(of_node, child) {
match = of_match_node(pl353_smc_supported_children, child);
if (!match) {
dev_warn(&adev->dev, "unsupported child node\n");
continue;
}
+ of_platform_device_create(child, NULL, &adev->dev);
break;
}
if (!match) {
@@ -106,9 +106,6 @@ static int pl353_smc_probe(struct amba_device *adev, const struct amba_id *id)
return -ENODEV;
}
- of_platform_device_create(child, NULL, &adev->dev);
- of_node_put(child);
-
return 0;
}