Re: (subset) [PATCH v2 0/7] Devm helpers for regulator get and enable

From: Mark Brown
Date: Tue Aug 16 2022 - 07:54:49 EST


On Tue, Aug 16, 2022 at 11:06:21AM +0000, Vaittinen, Matti wrote:

> I wonder if writing such 'release callbacks' is compulsory? I mean, if I
> was writing a driver to some new (to me) subsystem and was required to
> write an explicit release-callback for a resource - then it'd surely
> rang a bell about potentially double freeing stuff with devm. Especially
> if the doc stated the callback can be called after the driver has been
> detached.

Generally yes, thoguh people can and do leave them blank and it's easy
enough to do some cleanup in there that assumes that the device is still
present and not think the device might've gone away especially if the
hardware isn't practically hotpluggable.

Attachment: signature.asc
Description: PGP signature