From: Mark Brown <broonie@kernel.org>
To: Leon Romanovsky <leon@leon.nu>
Cc: "alsa-devel@alsa-project.org" <alsa-devel@alsa-project.org>,
patches <patches@opensource.wolfsonmicro.com>,
Liam Girdwood <lrg@ti.com>
Subject: Re: [PATCH] ASoC: wm8962: Convert to devm_input_allocate_device()
Date: Sun, 28 Apr 2013 10:47:45 +0100 [thread overview]
Message-ID: <20130428094745.GA5877@sirena.org.uk> (raw)
In-Reply-To: <CALq1K=+ViDvsCZDR5KndX-T1Dt6tghPjiP7F6wm+npYOw2DE1A@mail.gmail.com>
[-- Attachment #1.1: Type: text/plain, Size: 1312 bytes --]
On Sun, Apr 28, 2013 at 08:00:29AM +0300, Leon Romanovsky wrote:
> On Thu, Apr 25, 2013 at 3:52 PM, Mark Brown <broonie@kernel.org> wrote:
> > This seems like a bug that should be fixed on the API side, it's really
> > not what you'd expect a devm function to do, and if you are explicitly
> > freeing a devm allocated object there's an expectation that you need to
> > call a corresponding devm cleanup function.
> I can't agree with you about the "expectation" - device memory can be in use.
> This code will free memory after all references will be freed.
> Additionally it is up-to developer to decide what to do if
> input_register_device call failed.
> According to the code base
> (http://lxr.free-electrons.com/ident?i=input_free_device)
> the patch is not correct.
Right, but what I'm saying is that this is not how a devm_ API is
expected to behave and is therefore at best error prone on two fronts -
both due to the fact that you need to clean up explicitly even if the
resource is not actually managed and also due to the fact that the
regular free function is being used rather than a devm_ one when
explicit deallocation is done. Neither of these things is normal for a
devm_ API. The behaviour you're describing says that the managed
function should actually be registration not allocation.
[-- Attachment #1.2: Digital signature --]
[-- Type: application/pgp-signature, Size: 836 bytes --]
[-- Attachment #2: Type: text/plain, Size: 0 bytes --]
next prev parent reply other threads:[~2013-04-28 9:47 UTC|newest]
Thread overview: 12+ messages / expand[flat|nested] mbox.gz Atom feed top
2012-12-20 13:18 [PATCH] ASoC: wm8962: Convert to devm_input_allocate_device() Mark Brown
2013-04-24 13:50 ` Leon Romanovsky
2013-04-25 12:52 ` Mark Brown
2013-04-28 5:00 ` Leon Romanovsky
2013-04-28 9:47 ` Mark Brown [this message]
2013-04-28 18:32 ` Leon Romanovsky
2013-04-29 10:19 ` Mark Brown
2013-04-29 17:47 ` [alsa-devel] " Leon Romanovsky
2013-04-29 18:07 ` Dmitry Torokhov
2013-04-29 18:19 ` Dmitry Torokhov
2013-04-29 18:52 ` Leon Romanovsky
2013-04-29 20:01 ` Mark Brown
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20130428094745.GA5877@sirena.org.uk \
--to=broonie@kernel.org \
--cc=alsa-devel@alsa-project.org \
--cc=leon@leon.nu \
--cc=lrg@ti.com \
--cc=patches@opensource.wolfsonmicro.com \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
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.