On Tue, Sep 02, 2025 at 01:59:17PM +0200, Bartosz Golaszewski wrote: > > 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. While at it - replace krealloc() with more suitable > devm_krealloc_array().
With that in mind... > 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 > altogether and just add each function to the radix tree separately. ... > Tested-by: Neil Armstrong <[email protected]> This tag is not applicable to all patches, I do not believe this has been tested. ... > - keembay_funcs = kcalloc(kpc->npins * 8, sizeof(*keembay_funcs), > GFP_KERNEL); > + keembay_funcs = devm_kcalloc(kpc->dev, kpc->npins * 8, ...switching to size_mul() also adds more robustness against too big npins values. > + sizeof(*keembay_funcs), GFP_KERNEL); -- With Best Regards, Andy Shevchenko
