diff mbox

clk: ti: dra7-atl-clock: fix a memory leak

Message ID 1410529147-19950-1-git-send-email-t-kristo@ti.com
State Accepted
Commit 73b5d5f711f35617ff701bd88e887d3a1187e82b
Headers show

Commit Message

Tero Kristo Sept. 12, 2014, 1:39 p.m. UTC
of_clk_add_provider makes an internal copy of the parent_names property
while its called, thus it is no longer needed after this call and can
be freed.

Signed-off-by: Tero Kristo <t-kristo@ti.com>
Cc: Mike Turquette <mturquette@linaro.org>
Cc: Peter Ujfalusi <peter.ujfalusi@ti.com>
---
 drivers/clk/ti/clk-dra7-atl.c |    1 +
 1 file changed, 1 insertion(+)

Comments

Peter Ujfalusi Sept. 15, 2014, 9:05 a.m. UTC | #1
On 09/12/2014 04:39 PM, Tero Kristo wrote:
> of_clk_add_provider makes an internal copy of the parent_names property
> while its called, thus it is no longer needed after this call and can
> be freed.

Thanks Tero, indeed this was overlooked in the original driver.

Acked-by: Peter Ujfalusi <peter.ujfalusi@ti.com>


> Signed-off-by: Tero Kristo <t-kristo@ti.com>
> Cc: Mike Turquette <mturquette@linaro.org>
> Cc: Peter Ujfalusi <peter.ujfalusi@ti.com>
> ---
>  drivers/clk/ti/clk-dra7-atl.c |    1 +
>  1 file changed, 1 insertion(+)
> 
> diff --git a/drivers/clk/ti/clk-dra7-atl.c b/drivers/clk/ti/clk-dra7-atl.c
> index 4a65b41..3f9308a 100644
> --- a/drivers/clk/ti/clk-dra7-atl.c
> +++ b/drivers/clk/ti/clk-dra7-atl.c
> @@ -199,6 +199,7 @@ static void __init of_dra7_atl_clock_setup(struct device_node *node)
>  
>  	if (!IS_ERR(clk)) {
>  		of_clk_add_provider(node, of_clk_src_simple_get, clk);
> +		kfree(parent_names);
>  		return;
>  	}
>  cleanup:
>
Tero Kristo Sept. 29, 2014, 8:52 a.m. UTC | #2
On 09/15/2014 12:05 PM, Peter Ujfalusi wrote:
> On 09/12/2014 04:39 PM, Tero Kristo wrote:
>> of_clk_add_provider makes an internal copy of the parent_names property
>> while its called, thus it is no longer needed after this call and can
>> be freed.
>
> Thanks Tero, indeed this was overlooked in the original driver.
>
> Acked-by: Peter Ujfalusi <peter.ujfalusi@ti.com>

Applied to for-v3.18/ti-clk-driver.

-Tero

>
>
>> Signed-off-by: Tero Kristo <t-kristo@ti.com>
>> Cc: Mike Turquette <mturquette@linaro.org>
>> Cc: Peter Ujfalusi <peter.ujfalusi@ti.com>
>> ---
>>   drivers/clk/ti/clk-dra7-atl.c |    1 +
>>   1 file changed, 1 insertion(+)
>>
>> diff --git a/drivers/clk/ti/clk-dra7-atl.c b/drivers/clk/ti/clk-dra7-atl.c
>> index 4a65b41..3f9308a 100644
>> --- a/drivers/clk/ti/clk-dra7-atl.c
>> +++ b/drivers/clk/ti/clk-dra7-atl.c
>> @@ -199,6 +199,7 @@ static void __init of_dra7_atl_clock_setup(struct device_node *node)
>>
>>   	if (!IS_ERR(clk)) {
>>   		of_clk_add_provider(node, of_clk_src_simple_get, clk);
>> +		kfree(parent_names);
>>   		return;
>>   	}
>>   cleanup:
>>
>
>

--
To unsubscribe from this list: send the line "unsubscribe linux-omap" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
diff mbox

Patch

diff --git a/drivers/clk/ti/clk-dra7-atl.c b/drivers/clk/ti/clk-dra7-atl.c
index 4a65b41..3f9308a 100644
--- a/drivers/clk/ti/clk-dra7-atl.c
+++ b/drivers/clk/ti/clk-dra7-atl.c
@@ -199,6 +199,7 @@  static void __init of_dra7_atl_clock_setup(struct device_node *node)
 
 	if (!IS_ERR(clk)) {
 		of_clk_add_provider(node, of_clk_src_simple_get, clk);
+		kfree(parent_names);
 		return;
 	}
 cleanup: