linux-kernel.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH] clk: mvebu: armada-37xx-tbg: Balance devm_clk_get in probe
@ 2018-09-14 15:34 Gregory CLEMENT
  2018-10-10 17:36 ` Stephen Boyd
  0 siblings, 1 reply; 3+ messages in thread
From: Gregory CLEMENT @ 2018-09-14 15:34 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 devm_clk_put.

Signed-off-by: Gregory CLEMENT <gregory.clement@bootlin.com>
---
 drivers/clk/mvebu/armada-37xx-tbg.c | 1 +
 1 file changed, 1 insertion(+)

diff --git a/drivers/clk/mvebu/armada-37xx-tbg.c b/drivers/clk/mvebu/armada-37xx-tbg.c
index 71f30149e80e..caaa91a41683 100644
--- a/drivers/clk/mvebu/armada-37xx-tbg.c
+++ b/drivers/clk/mvebu/armada-37xx-tbg.c
@@ -102,6 +102,7 @@ static int armada_3700_tbg_clock_probe(struct platform_device *pdev)
 		return -EINVAL;
 	}
 	parent_name = __clk_get_name(parent);
+	devm_clk_put(dev, parent);
 
 	res = platform_get_resource(pdev, IORESOURCE_MEM, 0);
 	reg = devm_ioremap_resource(dev, res);
-- 
2.18.0


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

* Re: [PATCH] clk: mvebu: armada-37xx-tbg: Balance devm_clk_get in probe
  2018-09-14 15:34 [PATCH] clk: mvebu: armada-37xx-tbg: Balance devm_clk_get in probe Gregory CLEMENT
@ 2018-10-10 17:36 ` Stephen Boyd
  2018-10-10 18:06   ` Gregory CLEMENT
  0 siblings, 1 reply; 3+ messages in thread
From: Stephen Boyd @ 2018-10-10 17:36 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-09-14 08:34:21)
> 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 devm_clk_put.
> 
> Signed-off-by: Gregory CLEMENT <gregory.clement@bootlin.com>
> ---
>  drivers/clk/mvebu/armada-37xx-tbg.c | 1 +
>  1 file changed, 1 insertion(+)
> 
> diff --git a/drivers/clk/mvebu/armada-37xx-tbg.c b/drivers/clk/mvebu/armada-37xx-tbg.c
> index 71f30149e80e..caaa91a41683 100644
> --- a/drivers/clk/mvebu/armada-37xx-tbg.c
> +++ b/drivers/clk/mvebu/armada-37xx-tbg.c
> @@ -102,6 +102,7 @@ static int armada_3700_tbg_clock_probe(struct platform_device *pdev)
>                 return -EINVAL;
>         }
>         parent_name = __clk_get_name(parent);
> +       devm_clk_put(dev, parent);

So then why use devm_clk_get()? Please replace both so tha
devm_clk_put() doesn't need to be used..

>  
>         res = platform_get_resource(pdev, IORESOURCE_MEM, 0);
>         reg = devm_ioremap_resource(dev, res);

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

* Re: [PATCH] clk: mvebu: armada-37xx-tbg: Balance devm_clk_get in probe
  2018-10-10 17:36 ` Stephen Boyd
@ 2018-10-10 18:06   ` Gregory CLEMENT
  0 siblings, 0 replies; 3+ messages in thread
From: Gregory CLEMENT @ 2018-10-10 18:06 UTC (permalink / raw)
  To: Stephen Boyd
  Cc: Mike Turquette, Stephen Boyd, linux-clk, linux-kernel,
	Thomas Petazzoni, linux-arm-kernel, Jason Cooper, Andrew Lunn,
	Sebastian Hesselbarth, Antoine Tenart, Miquèl Raynal,
	Maxime Chevallier

Hi Stephen,
 
 On mer., oct. 10 2018, Stephen Boyd <sboyd@kernel.org> wrote:

> Quoting Gregory CLEMENT (2018-09-14 08:34:21)
>> 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 devm_clk_put.
>> 
>> Signed-off-by: Gregory CLEMENT <gregory.clement@bootlin.com>
>> ---
>>  drivers/clk/mvebu/armada-37xx-tbg.c | 1 +
>>  1 file changed, 1 insertion(+)
>> 
>> diff --git a/drivers/clk/mvebu/armada-37xx-tbg.c b/drivers/clk/mvebu/armada-37xx-tbg.c
>> index 71f30149e80e..caaa91a41683 100644
>> --- a/drivers/clk/mvebu/armada-37xx-tbg.c
>> +++ b/drivers/clk/mvebu/armada-37xx-tbg.c
>> @@ -102,6 +102,7 @@ static int armada_3700_tbg_clock_probe(struct platform_device *pdev)
>>                 return -EINVAL;
>>         }
>>         parent_name = __clk_get_name(parent);
>> +       devm_clk_put(dev, parent);
>
> So then why use devm_clk_get()? Please replace both so tha
> devm_clk_put() doesn't need to be used..

Indeed between the successful devm_clk_get and the devm_clk_put we don't
exit the function in error so I can use clk_get and clk_put.

Gregory

>
>>  
>>         res = platform_get_resource(pdev, IORESOURCE_MEM, 0);
>>         reg = devm_ioremap_resource(dev, res);

-- 
Gregory Clement, Bootlin
Embedded Linux and Kernel engineering
http://bootlin.com

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

end of thread, other threads:[~2018-10-10 18:06 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2018-09-14 15:34 [PATCH] clk: mvebu: armada-37xx-tbg: Balance devm_clk_get in probe Gregory CLEMENT
2018-10-10 17:36 ` Stephen Boyd
2018-10-10 18:06   ` Gregory CLEMENT

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).