All of lore.kernel.org
 help / color / mirror / Atom feed
* devm_* vs. PROBE_DEFFER: memory leaks?
@ 2019-05-31  8:52 Pavel Machek
  2019-05-31 13:27 ` Sebastian Reichel
  0 siblings, 1 reply; 2+ messages in thread
From: Pavel Machek @ 2019-05-31  8:52 UTC (permalink / raw)
  To: kernel list, dmitry.torokhov, gregkh, teheo, sre

[-- Attachment #1: Type: text/plain, Size: 415 bytes --]

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
-- 
(english) http://www.livejournal.com/~pavelmachek
(cesky, pictures) http://atrey.karlin.mff.cuni.cz/~pavel/picture/horses/blog.html

[-- Attachment #2: Digital signature --]
[-- Type: application/pgp-signature, Size: 181 bytes --]

^ permalink raw reply	[flat|nested] 2+ messages in thread

* Re: devm_* vs. PROBE_DEFFER: memory leaks?
  2019-05-31  8:52 devm_* vs. PROBE_DEFFER: memory leaks? Pavel Machek
@ 2019-05-31 13:27 ` Sebastian Reichel
  0 siblings, 0 replies; 2+ messages in thread
From: Sebastian Reichel @ 2019-05-31 13:27 UTC (permalink / raw)
  To: Pavel Machek; +Cc: kernel list, dmitry.torokhov, gregkh, teheo

[-- Attachment #1: Type: text/plain, Size: 636 bytes --]

Hi,

On Fri, May 31, 2019 at 10:52:10AM +0200, Pavel Machek wrote:
> Is devm_ supposed to work with EPROBE_DEFFER?

Sure.

> Probe function is now called multiple times;
> is memory freed between calling probe()?

Yes, EPROBE_DEFER is an error code, so devm resources
are released.

> 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

[-- Attachment #2: signature.asc --]
[-- Type: application/pgp-signature, Size: 833 bytes --]

^ permalink raw reply	[flat|nested] 2+ messages in thread

end of thread, other threads:[~2019-05-31 13:27 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2019-05-31  8:52 devm_* vs. PROBE_DEFFER: memory leaks? Pavel Machek
2019-05-31 13:27 ` Sebastian Reichel

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.