Commit c7d2f3fb authored by Bartosz Golaszewski's avatar Bartosz Golaszewski Committed by Krzysztof Kozlowski

memory: ti-aemif: Revert "memory: ti-aemif: don't needlessly iterate over child nodes"

This reverts commit 23a641d5.

The first-level children of the aemif node are not the device nodes (ones
containing the 'compatible' property) but the chip-select nodes which
instead have their own children.

of_platform_populate() will skip such nodes so we must indeed iterate
over the direct children of the aemif node. The problem here is that we
never call of_platform_depopulate() as it takes the root device as
argument. We only have an unpopulated chip-select nodes so we will leak
these devices if any of the calls to of_platform_populate() fails.

I don't have a batter idea right now but my patch was not correct so we
need to revert it. While at it: at least use the scoped variant of the
OF node iterator. Down the line, we should find a better solution to fix
this potential resource leak in error path.
Signed-off-by: default avatarBartosz Golaszewski <bartosz.golaszewski@linaro.org>
Link: https://lore.kernel.org/r/20240824080235.56472-1-brgl@bgdev.pl
Fixes: 23a641d5 ("memory: ti-aemif: don't needlessly iterate over child nodes")
Signed-off-by: default avatarKrzysztof Kozlowski <krzysztof.kozlowski@linaro.org>
parent 5e8431f7
......@@ -379,9 +379,11 @@ static int aemif_probe(struct platform_device *pdev)
* child will be probed after the AEMIF timing parameters are set.
*/
if (np) {
ret = devm_of_platform_populate(dev);
if (ret)
return ret;
for_each_available_child_of_node_scoped(np, child_np) {
ret = of_platform_populate(child_np, NULL, NULL, dev);
if (ret < 0)
return ret;
}
}
return 0;
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment