From: tj@kernel.org (Tejun Heo)
To: linux-arm-kernel@lists.infradead.org
Subject: [PATCH] pinctrl: use non-devm kmalloc versions for free functions
Date: Fri, 5 May 2017 17:49:32 -0400 [thread overview]
Message-ID: <20170505214932.GA29891@wtj.duckdns.org> (raw)
In-Reply-To: <20170505195518.xbn5n7uzo2xherah@lukather>
Hello, Maxime.
On Fri, May 05, 2017 at 09:55:18PM +0200, Maxime Ripard wrote:
> > It doesn't make any sense to use the managed functions from the
> > release functions and if you're always matching devm_kmalloc() with
> > devm_kfree(), the only thing it'd do is confusing its readers.
>
> I wouldn't say that being able to recover and free whatever memory
> leak we might have not making sense, but ok. That was one of the
> options, let's discard it.
>
> The other one is: refactor the rest of the allocations so that you
> don't have a mix of devm_kmalloc / devm_kfree and kmalloc / kfree for
> the same purpose in the same function.
So, I think the issues here are
1. Use of devm functions in a devres release function. This just
doesn't make sense.
2. If a resource is always allocated and freed in the same function,
there's no reason to use devres for it. I understand that there
can be exceptions for this, e.g. consistency, but it doesn't seem
to apply here.
3. Last but not least, allocating memory to destroy a radix tree. It
should be able to do that without allocating any memory.
Thanks.
--
tejun
next prev parent reply other threads:[~2017-05-05 21:49 UTC|newest]
Thread overview: 15+ messages / expand[flat|nested] mbox.gz Atom feed top
2017-05-03 23:57 [PATCH] pinctrl: use non-devm kmalloc versions for free functions Andre Przywara
2017-05-04 12:03 ` Maxime Ripard
2017-05-04 16:00 ` Tejun Heo
2017-05-05 0:41 ` André Przywara
2017-05-05 19:55 ` Maxime Ripard
2017-05-05 21:49 ` Tejun Heo [this message]
2017-05-11 14:01 ` Linus Walleij
2017-05-11 14:02 ` [linux-sunxi] " Icenowy Zheng
2017-05-11 14:20 ` Andre Przywara
2017-05-11 14:45 ` Tejun Heo
2017-05-12 9:25 ` Linus Walleij
2017-05-12 15:35 ` Tony Lindgren
2017-05-12 17:14 ` Tony Lindgren
2017-05-13 0:24 ` André Przywara
2017-05-22 15:37 ` Linus Walleij
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=20170505214932.GA29891@wtj.duckdns.org \
--to=tj@kernel.org \
--cc=linux-arm-kernel@lists.infradead.org \
/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 a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).