Re: [PATCH v1 2/4] regmap: Drop never used devm_regmap_*_free() APIs
From: Andy Shevchenko
Date: Mon Nov 16 2026 - 03:23:03 EST
On Fri, Nov 13, 2026 at 05:52:43PM +0000, Mark Brown wrote:
> On Thu, Nov 12, 2026 at 08:56:40AM +0200, Andy Shevchenko wrote:
> > On Wed, Nov 11, 2026 at 06:49:02PM +0000, Mark Brown wrote:
>
> > > I tend to think that if we have allocation functions we should have
> > > matching release functions, this avoids cross tree annoyances and bugs
> > > due to people using inappropriate release functions which actually
> > > exist rather than adding the ones they should use.
>
> > In general yes, but for devm_*() it makes not much sense as proven by dozens
> > of dropped "release/free" type of devm_*() calls in the past. Also as commit
> > message says for more than 10 years nobody used it even once. What does make
> > you think there eventually be at least a single user?
>
> Some of those release/free of devm issues are people intentionally doing
> a free and using the wrong function to do so, the main use case is
> enumerating something and deciding that some of the functionality is not
> usable so freeing the state for that functionality so you're not wasting
> memory carrying it around unused.
No objection on this in general, but for the mentioned APIs in this patch it's
not the case. Nobody *ever* used them. Why do you think we should keep a dead
code?
As for the memory side, we can also have a documentation that may list the
commit IDs and APIs where they were being deleted, so if one is interested
to resurrect them it can be done easily, however the quick universal method
is `git log -G ... -- include/linux/`. Ex:
git log -G devm_gpio_free -- include/linux/
commit 2b038e786f8338a3bc22d791000753e0ec113e00
Author: Andy Shevchenko <andriy.shevchenko@xxxxxxxxxxxxxxx>
Date: Wed Jun 22 20:28:42 2022 +0300
...
(and using specific folder speeds that up a lot).
--
With Best Regards,
Andy Shevchenko