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


Groups > linux.kernel > #1595904

Re: [PATCH v2] irq: generic-chip: provide irq_free_generic_chip()

From Bartosz Golaszewski <bgolaszewski@baylibre.com>
Newsgroups linux.kernel
Subject Re: [PATCH v2] irq: generic-chip: provide irq_free_generic_chip()
Date 2017-03-09 11:50 +0100
Message-ID <tj3NU-3XL-23@gated-at.bofh.it> (permalink)
References <tiNpM-1c7-19@gated-at.bofh.it> <tj3kS-3Nk-15@gated-at.bofh.it>
Organization linux.* mail to news gateway

Show all headers | View raw


2017-03-09 11:17 GMT+01:00 Thomas Gleixner <tglx@linutronix.de>:
> On Wed, 8 Mar 2017, Bartosz Golaszewski wrote:
>
>> Some users of irq_alloc_generic_chip() are modules which can be
>> removed (e.g. gpio-ml-ioh) but have no means of freeing the allocated
>> generic chip. Provide a function for that.
>
> They have means, i.e. kfree(gc). If you want a wrapper for that then please
> make it a simple static inline w/o the bloat of an exported symbol.
>

Yes, I want a wrapper, since there are no guarantees as to what
irq_alloc_generic_chip() does internally.

> But, what you really want is a proper counterpart to
> irq_alloc_generic_chip() which undoes everything what
> irq_alloc_generic_chip() does.
>
> You have to call irq_remove_generic_chip() before calling kfree() or the
> wrapper anyway. And looking at the 3 users of irq_remove_generic_chip():
>
> Two of them (drivers/gpio/gpio-tb10x.c drivers/mfd/jz4740-adc.c) do
>
>     irq_remove_generic_chip(gc)
>     kfree(gc)
>
> The third one (arch/arm/mach-omap2/prm_common.c) leaks the generic chip
> memory....
>
> So the proper solution is to rename irq_remove_generic_chip() to
> irq_destroy_generic_chip() and do the kfree() at the end of that function.
>
> Hmm?
>

Sounds good!

Thanks,
Bartosz

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


Thread

[PATCH v2] irq: generic-chip: provide irq_free_generic_chip() Bartosz Golaszewski <bgolaszewski@baylibre.com> - 2017-03-08 18:20 +0100
  Re: [PATCH v2] irq: generic-chip: provide irq_free_generic_chip() Marc Zyngier <marc.zyngier@arm.com> - 2017-03-09 09:10 +0100
  Re: [PATCH v2] irq: generic-chip: provide irq_free_generic_chip() Thomas Gleixner <tglx@linutronix.de> - 2017-03-09 11:20 +0100
    Re: [PATCH v2] irq: generic-chip: provide irq_free_generic_chip() Bartosz Golaszewski <bgolaszewski@baylibre.com> - 2017-03-09 11:50 +0100

csiph-web