On Thu, Jul 24, 2025 at 11:25 AM Bartosz Golaszewski <brgl@xxxxxxxx> wrote: > > From: Bartosz Golaszewski <bartosz.golaszewski@xxxxxxxxxx> > > Unlike all the other allocations in this driver, the memory for storing > the pin function descriptions allocated with kcalloc() and later resized > with krealloc() is never freed. Use devres like elsewhere to handle > that. > > Note: the logic in this module is pretty convoluted and could probably > use some revisiting, we should probably be able to calculate the exact > amount of memory needed in advance or even skip the allocation > alltogether and just add each function to the radix tree separately. altogether ... > /* Reallocate memory based on actual number of functions */ > - new_funcs = krealloc(keembay_funcs, kpc->nfuncs * sizeof(*new_funcs), GFP_KERNEL); > + new_funcs = devm_krealloc(kpc->dev, keembay_funcs, > + kpc->nfuncs * sizeof(*new_funcs), GFP_KERNEL); > if (!new_funcs) { krealloc_array() ? -- With Best Regards, Andy Shevchenko