linux-kernel.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH v2] clk: mvebu: armada-37xx-tbg: Switch to clk_get and balance it in probe
@ 2018-10-10 18:18 Gregory CLEMENT
  2018-10-16 23:51 ` Stephen Boyd
  0 siblings, 1 reply; 2+ messages in thread
From: Gregory CLEMENT @ 2018-10-10 18:18 UTC (permalink / raw)
  To: Stephen Boyd, Mike Turquette, linux-clk, linux-kernel
  Cc: Thomas Petazzoni, linux-arm-kernel, Jason Cooper, Andrew Lunn,
	Sebastian Hesselbarth, Gregory CLEMENT, Antoine Tenart,
	Miquèl Raynal, Maxime Chevallier

The parent clock is get only to have its name, and then the clock is no
more used, so we can safely free it using clk_put. Furthermore as between
the successful devm_clk_get() and the devm_clk_put() call we don't exit
the probe function in error so I can use non managed version of clk_get()
and clk_put().

Signed-off-by: Gregory CLEMENT <gregory.clement@bootlin.com>
---
Changelog:
v1 -> v2

 - Use the non managed version of clk_get() and clk_put() (suggested
   by Stephen Boyd)
 - Modify the title and the commit log to reflect this change

drivers/clk/mvebu/armada-37xx-tbg.c | 3 ++-
 1 file changed, 2 insertions(+), 1 deletion(-)

diff --git a/drivers/clk/mvebu/armada-37xx-tbg.c b/drivers/clk/mvebu/armada-37xx-tbg.c
index 71f30149e80e..ee272d4d8c24 100644
--- a/drivers/clk/mvebu/armada-37xx-tbg.c
+++ b/drivers/clk/mvebu/armada-37xx-tbg.c
@@ -96,12 +96,13 @@ static int armada_3700_tbg_clock_probe(struct platform_device *pdev)
 	hw_tbg_data->num = NUM_TBG;
 	platform_set_drvdata(pdev, hw_tbg_data);
 
-	parent = devm_clk_get(dev, NULL);
+	parent = clk_get(dev, NULL);
 	if (IS_ERR(parent)) {
 		dev_err(dev, "Could get the clock parent\n");
 		return -EINVAL;
 	}
 	parent_name = __clk_get_name(parent);
+	clk_put(parent);
 
 	res = platform_get_resource(pdev, IORESOURCE_MEM, 0);
 	reg = devm_ioremap_resource(dev, res);
-- 
2.19.1


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

* Re: [PATCH v2] clk: mvebu: armada-37xx-tbg: Switch to clk_get and balance it in probe
  2018-10-10 18:18 [PATCH v2] clk: mvebu: armada-37xx-tbg: Switch to clk_get and balance it in probe Gregory CLEMENT
@ 2018-10-16 23:51 ` Stephen Boyd
  0 siblings, 0 replies; 2+ messages in thread
From: Stephen Boyd @ 2018-10-16 23:51 UTC (permalink / raw)
  To: Gregory CLEMENT, Mike Turquette, Stephen Boyd, linux-clk, linux-kernel
  Cc: Thomas Petazzoni, linux-arm-kernel, Jason Cooper, Andrew Lunn,
	Sebastian Hesselbarth, Gregory CLEMENT, Antoine Tenart,
	Miquèl Raynal, Maxime Chevallier

Quoting Gregory CLEMENT (2018-10-10 11:18:38)
> The parent clock is get only to have its name, and then the clock is no
> more used, so we can safely free it using clk_put. Furthermore as between
> the successful devm_clk_get() and the devm_clk_put() call we don't exit
> the probe function in error so I can use non managed version of clk_get()
> and clk_put().
> 
> Signed-off-by: Gregory CLEMENT <gregory.clement@bootlin.com>
> ---

Applied to clk-next


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

end of thread, other threads:[~2018-10-16 23:51 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2018-10-10 18:18 [PATCH v2] clk: mvebu: armada-37xx-tbg: Switch to clk_get and balance it in probe Gregory CLEMENT
2018-10-16 23:51 ` Stephen Boyd

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).