Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]


Groups > linux.kernel > #1636760

Re: [PATCH] pinctrl: use non-devm kmalloc versions for free functions

From Tejun Heo <tj@kernel.org>
Newsgroups linux.kernel
Subject Re: [PATCH] pinctrl: use non-devm kmalloc versions for free functions
Date 2017-05-06 00:00 +0200
Message-ID <tDTqz-7re-27@gated-at.bofh.it> (permalink)
References <tDcvf-4cE-3@gated-at.bofh.it> <tDnK1-3f7-3@gated-at.bofh.it> <tDruh-5So-3@gated-at.bofh.it> <tDRyq-6eu-27@gated-at.bofh.it>
Organization linux.* mail to news gateway

Show all headers | View raw


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

Back to linux.kernel | Previous | NextPrevious in thread | Next in thread | Find similar | Unroll thread


Thread

[PATCH] pinctrl: use non-devm kmalloc versions for free functions Andre Przywara <andre.przywara@arm.com> - 2017-05-04 02:10 +0200
  Re: [PATCH] pinctrl: use non-devm kmalloc versions for free functions Maxime Ripard <maxime.ripard@free-electrons.com> - 2017-05-04 14:10 +0200
    Re: [PATCH] pinctrl: use non-devm kmalloc versions for free functions Tejun Heo <tj@kernel.org> - 2017-05-04 18:10 +0200
      Re: [PATCH] pinctrl: use non-devm kmalloc versions for free functions André Przywara <andre.przywara@arm.com> - 2017-05-05 02:50 +0200
      Re: [PATCH] pinctrl: use non-devm kmalloc versions for free functions Maxime Ripard <maxime.ripard@free-electrons.com> - 2017-05-05 22:00 +0200
        Re: [PATCH] pinctrl: use non-devm kmalloc versions for free functions Tejun Heo <tj@kernel.org> - 2017-05-06 00:00 +0200
  Re: [PATCH] pinctrl: use non-devm kmalloc versions for free functions Linus Walleij <linus.walleij@linaro.org> - 2017-05-11 16:10 +0200
    Re: [linux-sunxi] Re: [PATCH] pinctrl: use non-devm kmalloc versions for free functions Icenowy Zheng <icenowy@aosc.io> - 2017-05-11 16:20 +0200
    Re: [PATCH] pinctrl: use non-devm kmalloc versions for free functions Tejun Heo <tj@kernel.org> - 2017-05-11 16:50 +0200
    Re: [PATCH] pinctrl: use non-devm kmalloc versions for free functions Andre Przywara <andre.przywara@arm.com> - 2017-05-11 17:30 +0200

csiph-web