Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1754493AbdCIKRg (ORCPT ); Thu, 9 Mar 2017 05:17:36 -0500 Received: from Galois.linutronix.de ([146.0.238.70]:50171 "EHLO Galois.linutronix.de" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1752894AbdCIKRf (ORCPT ); Thu, 9 Mar 2017 05:17:35 -0500 Date: Thu, 9 Mar 2017 11:17:29 +0100 (CET) From: Thomas Gleixner To: Bartosz Golaszewski cc: Marc Zyngier , linux-kernel@vger.kernel.org Subject: Re: [PATCH v2] irq: generic-chip: provide irq_free_generic_chip() In-Reply-To: <1488992645-9980-1-git-send-email-bgolaszewski@baylibre.com> Message-ID: References: <1488992645-9980-1-git-send-email-bgolaszewski@baylibre.com> User-Agent: Alpine 2.20 (DEB 67 2015-01-07) MIME-Version: 1.0 Content-Type: text/plain; charset=US-ASCII Sender: linux-kernel-owner@vger.kernel.org List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Length: 1017 Lines: 31 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. 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? tglx