Re: sun50i-a64-pinctrl WARN_ON drivers/base/dd.c:349

From: Tejun Heo
Date: Mon May 01 2017 - 15:27:14 EST


On Sun, Apr 30, 2017 at 12:34:40AM +0100, André Przywara wrote:
> >> If this is a valid use case, we can change devm to repeat till empty
> >> but it's a weird thing to do to allocate from a release function.
> >>
> >> So, something like this. Only compile tested.
> I was wondering if using devm_*alloc in a _release_ function is valid at
> all, given that it is called as part of the DEFER clean-up routine.
> Looking at pinmux_generic_free_functions() it looks like we could
> replace it with a (non-devm_) kmalloc version and it would still work
> (given we add a kfree at the end).
> Either that or we bail out early if pctldev->num_functions is zero.

I was just throwing the idea but the more I think about it, the less
sense it makes to me. So, I really think this should be fixed by
dropping dev_kzalloc() call from the release function. It makes no