devm_* vs. PROBE_DEFFER: memory leaks?
Hi!
Is devm_ supposed to work with EPROBE_DEFFER?
Probe function is now called multiple times; is memory freed between calling probe()? Will allocations from failed probe()s remain after the driver is inserted successfully, leaking memory?
Thanks,
Pavel
Signature · 2 lines
(english) http://www.livejournal.com/~pavelmachek (cesky, pictures) http://atrey.karlin.mff.cuni.cz/~pavel/picture/horses/blog.html
Hi,
Quoted 1 line · Pavel Machek
Is
devm_supposed to work withEPROBE_DEFFER?
Sure.
Quoted 2 lines
Probe function is now called multiple times;
is memory freed between callingprobe()?
Yes, EPROBE_DEFER is an error code, so devm resources are released.
Quoted 2 lines
Will allocations from failed probe()s remain after the driver is inserted successfully, leaking memory?
devm_ is connected to the device, not to the driver.
Since code is better than words, check drivers/base/dd.c yourself. The relevant function name is really_probe(), interesting part for you starts at ret = drv->probe(dev) line.
-- Sebastian