public inbox for linux-kernel@vger.kernel.org
 help / color / mirror / Atom feed
* [PATCH v1] clkdev: prevent potential memory leak when used in modules
@ 2015-02-03 18:18 Andy Shevchenko
  2015-02-03 18:18 ` [PATCH v1] clkdev: change prototype of clk_register_clkdev() Andy Shevchenko
  0 siblings, 1 reply; 5+ messages in thread
From: Andy Shevchenko @ 2015-02-03 18:18 UTC (permalink / raw)
  To: linux-kernel, Stephen Boyd, Mike Turquette, Lee Jones,
	Bryan Huntsman, Lorenzo Pieralisi, Ralf Baechle,
	Sylwester Nawrocki
  Cc: Andy Shevchenko

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


^ permalink raw reply	[flat|nested] 5+ messages in thread

end of thread, other threads:[~2015-02-04 23:18 UTC | newest]

Thread overview: 5+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2015-02-03 18:18 [PATCH v1] clkdev: prevent potential memory leak when used in modules Andy Shevchenko
2015-02-03 18:18 ` [PATCH v1] clkdev: change prototype of clk_register_clkdev() Andy Shevchenko
2015-02-04 15:50   ` Mika Westerberg
2015-02-04 16:03     ` Andy Shevchenko
2015-02-04 23:18   ` Stephen Boyd

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox