Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]
Groups > linux.kernel > #1635866
| From | Tejun Heo <tj@kernel.org> |
|---|---|
| Newsgroups | linux.kernel |
| Subject | Re: [PATCH] pinctrl: use non-devm kmalloc versions for free functions |
| Date | 2017-05-04 18:10 +0200 |
| Message-ID | <tDruh-5So-3@gated-at.bofh.it> (permalink) |
| References | <tDcvf-4cE-3@gated-at.bofh.it> <tDnK1-3f7-3@gated-at.bofh.it> |
| Organization | linux.* mail to news gateway |
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. And the function in question just looks weird to me - give up on freeing resources if memory allocation fails? And why call devm_kfree() on objects which are being released anyway? Or if the group can be released w/o the device being detached, why use devm allocations on the members at all? As for removal, can't it just call radix_tree_iter_delete() while iterating? Why allocate memory to iterate and store all indices and to look them up again and delete them? Thanks. -- tejun
Back to linux.kernel | Previous | Next — Previous in thread | Next in thread | Find similar | Unroll 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