From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S966486AbbBCSXY (ORCPT ); Tue, 3 Feb 2015 13:23:24 -0500 Received: from mga09.intel.com ([134.134.136.24]:20071 "EHLO mga09.intel.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S965602AbbBCSXX (ORCPT ); Tue, 3 Feb 2015 13:23:23 -0500 X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="5.09,514,1418112000"; d="scan'208";a="646791134" From: Andy Shevchenko To: linux-kernel@vger.kernel.org, Stephen Boyd , Mike Turquette , Lee Jones , Bryan Huntsman , Lorenzo Pieralisi , Ralf Baechle , Sylwester Nawrocki Cc: Andy Shevchenko Subject: [PATCH v1] clkdev: prevent potential memory leak when used in modules Date: Tue, 3 Feb 2015 20:18:53 +0200 Message-Id: <1422987534-21832-1-git-send-email-andriy.shevchenko@linux.intel.com> X-Mailer: git-send-email 2.1.4 Sender: linux-kernel-owner@vger.kernel.org List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Since clk_register_clkdev() is exported for modules the caller should get a pointer to the allocated resources. Otherwise the memory leak is guaranteed on the ->remove() stage. The patch changes the prototype of the clk_register_clkdev() to return pointer to the allocated resources. The caller should take care of the returned variable and free allocated resources when needed. Together with the main change the users are updated too. The patch compile tested on x86, thus requires to be tested on touched architectures. Andy Shevchenko (1): clkdev: change prototype of clk_register_clkdev() arch/arm/mach-msm/clock-pcom.c | 9 +++++---- arch/arm/mach-vexpress/spc.c | 5 ++++- arch/mips/ath79/clock.c | 6 +++--- drivers/clk/clk-bcm2835.c | 12 +++++++----- drivers/clk/clk-max-gen.c | 9 ++++----- drivers/clk/clk-xgene.c | 6 +++--- drivers/clk/clkdev.c | 14 +++++++++----- drivers/clk/samsung/clk-pll.c | 13 ++++++++----- drivers/clk/samsung/clk-s3c2410-dclk.c | 19 +++++++++--------- drivers/clk/samsung/clk.c | 35 +++++++++++++++++++--------------- include/linux/clkdev.h | 2 +- 11 files changed, 74 insertions(+), 56 deletions(-) -- 2.1.4