diff options
| author | Tom Rini <[email protected]> | 2026-01-09 09:08:18 -0600 |
|---|---|---|
| committer | Tom Rini <[email protected]> | 2026-01-09 10:19:57 -0600 |
| commit | 1bcb2fe324180d0a8cfbdb0511737eba1d5b8550 (patch) | |
| tree | 8b7449bae3c6c2202bab853f75813e9c43932bf1 /drivers/core | |
| parent | cf51247c632fe6f1f6c29a6f7754b99915182142 (diff) | |
| parent | 217cf656e249f698d390a7d8eaf255eb1a6c0230 (diff) | |
Merge patch series "Enable / require DEVRES for devm_.alloc usage outside xPL"
Tom Rini <[email protected]> says:
As seen by a number of patches fixing memory leaks, U-Boot has a problem
with developer expectations around devm_kmalloc and friends. Namely,
whereas in Linux these memory allocations will be freed automatically in
most cases, in U-Boot this is only true if DEVRES is enabled. Now,
intentionally, in xPL phases, we do not (and do not offer as an option)
enabling DEVRES. However in full U-Boot this is left either to the user,
or some drivers have select'd DEVRES on their own. This inconsistency is
a problem. This series goes and deals with two small issues that were
shown by having all drivers that use devm_.alloc to allocate memory also
select DEVRES and then we make DEVRES no longer be a prompted option and
instead select'd as needed. We do not make this unconditional as it
would result in growing the resulting binary on the many platforms which
have no users of the devm_.alloc family of functions.
Link: https://lore.kernel.org/r/[email protected]
Diffstat (limited to 'drivers/core')
| -rw-r--r-- | drivers/core/Kconfig | 10 |
1 files changed, 6 insertions, 4 deletions
diff --git a/drivers/core/Kconfig b/drivers/core/Kconfig index 6b4330fe4ea..c9253099e6e 100644 --- a/drivers/core/Kconfig +++ b/drivers/core/Kconfig @@ -197,6 +197,7 @@ config DM_DMA config REGMAP bool "Support register maps" depends on DM + select DEVRES help Hardware peripherals tend to have one or more sets of registers which can be accessed to control the hardware. A register map @@ -271,16 +272,17 @@ config VPL_SYSCON assigning a unique number to each. config DEVRES - bool "Managed device resources" + bool depends on DM help This option enables the Managed device resources core support. Device resources managed by the devres framework are automatically released whether initialization fails half-way or the device gets - detached. + detached. This is most often used via devm_kmalloc and family and + is expected to work in a manner analogous to the Linux Kernel. - If this option is disabled, devres functions fall back to - non-managed variants. For example, devres_alloc() to kzalloc(), + This option is disabled in xPL phases and devres functions fall back + to non-managed variants. For example, devres_alloc() to kzalloc(), devm_kmalloc() to kmalloc(), etc. config DEBUG_DEVRES |
