On Wed, Jul 07, 2021 at 12:34:31PM +0100, James Bottomley wrote: > On Wed, 2021-07-07 at 11:50 +0100, Mark Brown wrote: > > There *are* issues with people adopting it too enthusiastically - as > > well as the memory lifetime issues that Laurent mentioned it's easy > > for it to cause problems with interrupt handlers that are left live > > longer than they should be and try to use things that were already > > deallocated. > Fixing this should not be beyond the wit of humankind, though. If we > delayed deallocation to module release, that would fix the interrupt > issue, wouldn't it? Perhaps all devres memory for devices should live No, that's half the problem - as Greg says there's the issue of module vs device lifespans, and you sometimes also have to take care with the ordering of your allocations and unwindings within device startup and teardown so you don't end up trying to do something like deliver an interrupt to the subsystem core after having told the subsystem the device was gone, or trying to process a final subsystem call that needs interrupts after you've freed interrupts.