summaryrefslogtreecommitdiff
path: root/drivers/net
diff options
context:
space:
mode:
authorTom Rini <trini@konsulko.com>2025-12-27 16:37:11 -0600
committerTom Rini <trini@konsulko.com>2026-01-09 09:08:14 -0600
commit217cf656e249f698d390a7d8eaf255eb1a6c0230 (patch)
tree517b0cbaabb08056ff41b7e2d9699ce58ae7880f /drivers/net
parent284e1a00f4f28dcd6ddc8c860d22f1c8c427c5d5 (diff)
dm: core: Default to using DEVRES outside of xPL
The devm alloc functions that we have may follow the Linux kernel model where allocations are (almost always) automatically free()'d. However, quite often we don't enable, in full U-Boot, the tracking and free()'ing functionality. This in turn leads to memory leaks because the driver author expects that since the functions have the same name as in the Linux Kernel they have the same behavior. In turn we then get functionally correct commits such as commit 00e1fed93c8c ("firmware: ti_sci: Fix memory leaks in devm_ti_sci_get_of_resource") that manually add these calls. Rather than manually tracking allocations and implementing free()s, rework things so that we follow expectations by enabling the DEVRES functionality (outside of xPL phases). This turns DEVRES from a prompted symbol to a symbol that must be select'd, and we now remove our non-managed alloc/free functions from outside of xPL builds. Reviewed-by: Michael Trimarchi <michael@amarulasolutions.com> Signed-off-by: Tom Rini <trini@konsulko.com>
Diffstat (limited to 'drivers/net')
-rw-r--r--drivers/net/Kconfig3
-rw-r--r--drivers/net/phy/Kconfig2
2 files changed, 5 insertions, 0 deletions
diff --git a/drivers/net/Kconfig b/drivers/net/Kconfig
index f382a7752d5..13e631c55dc 100644
--- a/drivers/net/Kconfig
+++ b/drivers/net/Kconfig
@@ -125,6 +125,7 @@ config AIROHA_ETH
bool "Airoha Ethernet QDMA Driver"
depends on ARCH_AIROHA
select PHYLIB
+ select DEVRES
select DM_RESET
select MDIO_MT7531
help
@@ -359,6 +360,7 @@ config ETH_SANDBOX_RAW
config ETH_DESIGNWARE
bool "Synopsys Designware Ethernet MAC"
+ select DEVRES
select PHYLIB
imply ETH_DESIGNWARE_SOCFPGA if ARCH_SOCFPGA
help
@@ -555,6 +557,7 @@ config MVNETA
config MVPP2
bool "Marvell Armada 375/7K/8K network interface support"
depends on ARMADA_375 || ARMADA_8K
+ select DEVRES
select PHYLIB
select MVMDIO
select DM_MDIO
diff --git a/drivers/net/phy/Kconfig b/drivers/net/phy/Kconfig
index d0aab0b8fe8..709f1c91eb2 100644
--- a/drivers/net/phy/Kconfig
+++ b/drivers/net/phy/Kconfig
@@ -182,6 +182,7 @@ config PHY_MARVELL
config PHY_MARVELL_10G
bool "Marvell Alaska 10Gbit PHYs"
+ select DEVRES
help
Support for the Marvell Alaska MV88X3310 and compatible PHYs.
@@ -245,6 +246,7 @@ config PHY_NATSEMI
config PHY_NXP_C45_TJA11XX
tristate "NXP C45 TJA11XX PHYs"
+ select DEVRES
help
Enable support for NXP C45 TJA11XX PHYs.
Currently supports only the TJA1103 PHY.