On 18-01-21, 20:17, Shawn Guo wrote: > On Wed, Jan 13, 2021 at 10:36:51AM +0530, Viresh Kumar wrote: > > On 12-01-21, 22:59, Bjorn Andersson wrote: > > > But that said, why are the ioremap done at init and not at probe time? > > > > These are some hardware registers per cpufreq policy I believe, and so > > they did it from policy init instead. > > > > And yes I agree that we shouldn't use devm_ from init() for the cases > > where we need to put the resources in exit() as well. But things like > > devm_kzalloc() are fine there. > > I'm not sure why devm_kzalloc() is fine there. IIUIC, the memory > allocated by devm_kzalloc() in init() is not freed up from exit(), as > &pdev->dev is alive across init/exit cycles and will not trigger devres > auto free-up. Yes, but reallocating it again if ->init() get called again isn't a bug and will only block a part of memory for sometime, i.e. until the time driver isn't removed. Though it is better I think to get rid of it as well. -- viresh