]> www.infradead.org Git - users/jedix/linux-maple.git/commit
memory: ti-aemif: Revert "memory: ti-aemif: don't needlessly iterate over child nodes"
authorBartosz Golaszewski <bartosz.golaszewski@linaro.org>
Sat, 24 Aug 2024 08:02:35 +0000 (10:02 +0200)
committerKrzysztof Kozlowski <krzysztof.kozlowski@linaro.org>
Sun, 25 Aug 2024 08:24:23 +0000 (10:24 +0200)
commitc7d2f3fbdf59b206414ddc306b0fb74cd174c0ed
treeee82b93f9d36b38398f8dc37111cb76168ef0392
parent5e8431f722d95bf58276a3051240c1ebe3cc238d
memory: ti-aemif: Revert "memory: ti-aemif: don't needlessly iterate over child nodes"

This reverts commit 23a641d5c2bce4c723fff9118a5d865ee6b9d05a.

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: Bartosz Golaszewski <bartosz.golaszewski@linaro.org>
Link: https://lore.kernel.org/r/20240824080235.56472-1-brgl@bgdev.pl
Fixes: 23a641d5c2bc ("memory: ti-aemif: don't needlessly iterate over child nodes")
Signed-off-by: Krzysztof Kozlowski <krzysztof.kozlowski@linaro.org>
drivers/memory/ti-aemif.c