From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1753175AbbIQA31 (ORCPT ); Wed, 16 Sep 2015 20:29:27 -0400 Received: from bear.ext.ti.com ([192.94.94.41]:53413 "EHLO bear.ext.ti.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1752640AbbIQA3Y (ORCPT ); Wed, 16 Sep 2015 20:29:24 -0400 From: Suman Anna To: Ohad Ben-Cohen , "Michael S. Tsirkin" CC: , , Suman Anna Subject: [PATCH 2/2] remoteproc: fix memory leak of remoteproc ida cache layers Date: Wed, 16 Sep 2015 19:29:18 -0500 Message-ID: <1442449758-14594-3-git-send-email-s-anna@ti.com> X-Mailer: git-send-email 2.5.0 In-Reply-To: <1442449758-14594-1-git-send-email-s-anna@ti.com> References: <1442449758-14594-1-git-send-email-s-anna@ti.com> MIME-Version: 1.0 Content-Type: text/plain Sender: linux-kernel-owner@vger.kernel.org List-ID: X-Mailing-List: linux-kernel@vger.kernel.org The remoteproc core uses a static ida named rproc_dev_index for assigning an automatic index number to a registered remoteproc. The ida core may allocate some internal idr cache layers and ida bitmap upon any ida allocation, and all these layers are truely freed only upon the ida destruction. The rproc_dev_index ida is not destroyed at present, leading to a memory leak when using the remoteproc core as a module and atleast one rproc device is registered and unregistered. Fix this by invoking ida_destroy() in the remoteproc core module exit. Cc: Ohad Ben-Cohen Signed-off-by: Suman Anna --- drivers/remoteproc/remoteproc_core.c | 2 ++ 1 file changed, 2 insertions(+) diff --git a/drivers/remoteproc/remoteproc_core.c b/drivers/remoteproc/remoteproc_core.c index 8b3130f22b42..9e03d158f411 100644 --- a/drivers/remoteproc/remoteproc_core.c +++ b/drivers/remoteproc/remoteproc_core.c @@ -1478,6 +1478,8 @@ module_init(remoteproc_init); static void __exit remoteproc_exit(void) { + ida_destroy(&rproc_dev_index); + rproc_exit_debugfs(); } module_exit(remoteproc_exit); -- 2.5.0