Merge patch series "Enable / require DEVRES for devm_.alloc usage outside xPL"
Tom Rini <trini@konsulko.com> 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/20251227223833.3019311-1-trini@konsulko.com
This commit is contained in:
@@ -207,7 +207,8 @@ void devm_kfree(struct udevice *dev, void *ptr);
|
||||
/* Get basic stats on allocations */
|
||||
void devres_get_stats(const struct udevice *dev, struct devres_stats *stats);
|
||||
|
||||
#else /* ! DEVRES */
|
||||
#elif IS_ENABLED(CONFIG_DEVRES) && defined(CONFIG_XPL_BUILD)
|
||||
/* Allow these to be dummy functions in xPL builds. */
|
||||
|
||||
static inline void *devres_alloc(dr_release_t release, size_t size, gfp_t gfp)
|
||||
{
|
||||
|
||||
Reference in New Issue
Block a user