lkml.org 
[lkml]   [2017]   [May]   [5]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
 
Messages in this thread
/
Date
From
SubjectRe: [PATCH] pinctrl: use non-devm kmalloc versions for free functions
On Thu, May 04, 2017 at 12:00:32PM -0400, Tejun Heo wrote:
> Hello,
>
> On Thu, May 04, 2017 at 02:03:14PM +0200, Maxime Ripard wrote:
> > > @@ -704,6 +704,7 @@ static void pinctrl_generic_free_groups(struct pinctrl_dev *pctldev)
> > > radix_tree_delete(&pctldev->pin_group_tree, indices[i]);
> > > devm_kfree(pctldev->dev, group);
> > > }
> > > + kfree(indices);
> >
> > We use devm_kfree for other allocations done here, maybe we can just
> > have the same thing here? We would be consistant, and we would still
> > keep the resource tracking.
>
> 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.

Maxime

--
Maxime Ripard, Free Electrons
Embedded Linux and Kernel engineering
http://free-electrons.com
[unhandled content-type:application/pgp-signature]
\
 
 \ /
  Last update: 2017-05-05 21:57    [W:0.094 / U:0.268 seconds]
©2003-2020 Jasper Spaans|hosted at Digital Ocean and TransIP|Read the blog|Advertise on this site