[U-Boot] [RFC PATCH 06/12] devres: introduce Devres (Managed Device Resource) framework

Simon Glass sjg at chromium.org
Thu Jul 9 17:12:59 CEST 2015


Hi Albert,

On 9 July 2015 at 09:03, Albert ARIBAUD <albert.u.boot at aribaud.net> wrote:
> Hello Simon,
>
> On Thu, 9 Jul 2015 07:31:05 -0600, Simon Glass <sjg at chromium.org> wrote:
>> Hi,
>>
>> On 8 July 2015 at 23:41, Albert ARIBAUD <albert.u.boot at aribaud.net> wrote:
>> > Hello Masahiro,
>> >
>> > On Thu, 9 Jul 2015 14:16:33 +0900, Masahiro Yamada
>> > <yamada.masahiro at socionext.com> wrote:
>> >> Hi Simon,
>> >>
>> >> > 3. How do we handle things like gpio_exynos_bind() which allocs some
>> >> > data and passes it to a device it creates, as platform data? At
>> >> > present we don't free it.
>> >>
>> >> So, currently this driver is leaking the memory, isn't it?
>> >>
>> >> If we use devm_kzalloc() here, the platdata for GPIOs
>> >> will be released when the parent pinctrl is unbound.
>> >
>> > Does gpio_exynos_bind() get called enough between entry and exit from
>> > U-boot that the memory leaks prevent U-Boot from doing its job properly?
>>
>> No we only bind devices once in U-Boot, except for USB which recently changed.
>
> Then I'll be the Devil's advocate and question the interest of adding
> code in U-Boot to fix a leak which, when it happens at all, does not
> substantially affect U-Boot's functionality.

Yes, I don't think it matters in practice. I could fix it in the
current code too. To be complete we also need a way to 'allocate'
driver names such that they are freed when unbound. Not all names are
static strings.

Regards
Simon


More information about the U-Boot mailing list