net: stmmac: dwc-qos: fix clk prepare/enable leak on probe failure
authorRussell King (Oracle) <rmk+kernel@armlinux.org.uk>
Fri, 8 Aug 2025 12:16:39 +0000 (13:16 +0100)
committerJakub Kicinski <kuba@kernel.org>
Tue, 12 Aug 2025 03:11:48 +0000 (20:11 -0700)
commit89886abd073489e26614e4d80fb8eb70d3938a0b
tree70e56cf5cad4d8973b3fcbc2921f1c8efc797978
parentde1e963ad064caf73ee2c7485b925f381a3aefbf
net: stmmac: dwc-qos: fix clk prepare/enable leak on probe failure

dwc_eth_dwmac_probe() gets bulk clocks, and then prepares and enables
them. Unfortunately, if dwc_eth_dwmac_config_dt() or stmmac_dvr_probe()
fail, we leave the clocks prepared and enabled. Fix this by using
devm_clk_bulk_get_all_enabled() to combine the steps and provide devm
based release of the prepare and enable state.

This also fixes a similar leakin dwc_eth_dwmac_remove() which wasn't
correctly retrieving the struct plat_stmmacenet_data. This becomes
unnecessary.

Signed-off-by: Russell King (Oracle) <rmk+kernel@armlinux.org.uk>
Reviewed-by: Simon Horman <horms@kernel.org>
Fixes: a045e40645df ("net: stmmac: refactor clock management in EQoS driver")
Link: https://patch.msgid.link/E1ukM1X-0086qu-Td@rmk-PC.armlinux.org.uk
Signed-off-by: Jakub Kicinski <kuba@kernel.org>
drivers/net/ethernet/stmicro/stmmac/dwmac-dwc-qos-eth.c