]> git.ipfire.org Git - thirdparty/kernel/stable.git/commit
net: stmmac: restructure the error path of stmmac_probe_config_dt()
authorJoe Hattori <joe@pf.is.s.u-tokyo.ac.jp>
Thu, 19 Dec 2024 02:41:19 +0000 (11:41 +0900)
committerGreg Kroah-Hartman <gregkh@linuxfoundation.org>
Thu, 9 Jan 2025 12:28:46 +0000 (13:28 +0100)
commit4261fc54ca7764d545c7956aadd85787c046842c
tree2ea404c3a0bf6e7110b66d2268af67d08fa37a1f
parentf0da70367048ca006cc33c156f254281950f595e
net: stmmac: restructure the error path of stmmac_probe_config_dt()

[ Upstream commit 2b6ffcd7873b7e8a62c3e15a6f305bfc747c466b ]

Current implementation of stmmac_probe_config_dt() does not release the
OF node reference obtained by of_parse_phandle() in some error paths.
The problem is that some error paths call stmmac_remove_config_dt() to
clean up but others use and unwind ladder.  These two types of error
handling have not kept in sync and have been a recurring source of bugs.
Re-write the error handling in stmmac_probe_config_dt() to use an unwind
ladder. Consequently, stmmac_remove_config_dt() is not needed anymore,
thus remove it.

This bug was found by an experimental verification tool that I am
developing.

Fixes: 4838a5405028 ("net: stmmac: Fix wrapper drivers not detecting PHY")
Signed-off-by: Joe Hattori <joe@pf.is.s.u-tokyo.ac.jp>
Link: https://patch.msgid.link/20241219024119.2017012-1-joe@pf.is.s.u-tokyo.ac.jp
Signed-off-by: Jakub Kicinski <kuba@kernel.org>
Signed-off-by: Sasha Levin <sashal@kernel.org>
drivers/net/ethernet/stmicro/stmmac/stmmac_platform.c