2014-01-30 11:37:31

by Ivan Khoronzhuk

[permalink] [raw]
Subject: [PATCH] clk: keystone: gate: fix clk_init_data initialization

In clk_register_psc() function clk_init_data struct is allocated
in the stack. All members of this struct should be initialized
before using otherwise it will contain garbage. So initialize flags
in this structure too.

Signed-off-by: Ivan Khoronzhuk <[email protected]>
---
drivers/clk/keystone/gate.c | 1 +
1 file changed, 1 insertion(+)

diff --git a/drivers/clk/keystone/gate.c b/drivers/clk/keystone/gate.c
index 17a5983..86f1e36 100644
--- a/drivers/clk/keystone/gate.c
+++ b/drivers/clk/keystone/gate.c
@@ -179,6 +179,7 @@ static struct clk *clk_register_psc(struct device *dev,

init.name = name;
init.ops = &clk_psc_ops;
+ init.flags = 0;
init.parent_names = (parent_name ? &parent_name : NULL);
init.num_parents = (parent_name ? 1 : 0);

--
1.8.3.2


2014-01-30 13:49:54

by Ivan Khoronzhuk

[permalink] [raw]
Subject: Re: [PATCH] clk: keystone: gate: fix clk_init_data initialization

Yes. As result the clk->flag field contains garbage. In my case it leads
that flag CLK_IGNORE_UNUSED is set for most of clocks. As result a bunch
of unused clocks cannot be disabled.

On 01/30/2014 03:26 PM, Shilimkar, Santosh wrote:
> Can u capture the issue withiout this fix?
>
> Sent from my Android phone using TouchDown (http://www.nitrodesk.com)
>
> -----Original Message-----
> *From:* Khoronzhuk, Ivan [[email protected]]
> *Received:* Thursday, 30 Jan 2014, 6:37am
> *To:* Shilimkar, Santosh [[email protected]]
> *CC:* [email protected] [[email protected]];
> [email protected] [[email protected]];
> [email protected] [[email protected]]; Khoronzhuk, Ivan
> [[email protected]]
> *Subject:* [PATCH] clk: keystone: gate: fix clk_init_data initialization
>
> In clk_register_psc() function clk_init_data struct is allocated
> in the stack. All members of this struct should be initialized
> before using otherwise it will contain garbage. So initialize flags
> in this structure too.
>
> Signed-off-by: Ivan Khoronzhuk <[email protected]>
> ---
> drivers/clk/keystone/gate.c | 1 +
> 1 file changed, 1 insertion(+)
>
> diff --git a/drivers/clk/keystone/gate.c b/drivers/clk/keystone/gate.c
> index 17a5983..86f1e36 100644
> --- a/drivers/clk/keystone/gate.c
> +++ b/drivers/clk/keystone/gate.c
> @@ -179,6 +179,7 @@ static struct clk *clk_register_psc(struct device *dev,
>
> init.name = name;
> init.ops = &clk_psc_ops;
> + init.flags = 0;
> init.parent_names = (parent_name ? &parent_name : NULL);
> init.num_parents = (parent_name ? 1 : 0);
>
> --
> 1.8.3.2
>

2014-01-30 14:32:56

by Santosh Shilimkar

[permalink] [raw]
Subject: Re: [PATCH] clk: keystone: gate: fix clk_init_data initialization

On Thursday 30 January 2014 08:49 AM, Ivan Khoronzhuk wrote:
> Yes. As result the clk->flag field contains garbage. In my case it leads
> that flag CLK_IGNORE_UNUSED is set for most of clocks. As result a bunch
> of unused clocks cannot be disabled.
>
Can you please update the change log with above information.

> On 01/30/2014 03:26 PM, Shilimkar, Santosh wrote:
>> Can u capture the issue withiout this fix?
>>
>> Sent from my Android phone using TouchDown (http://www.nitrodesk.com)
>>
>> -----Original Message-----
>> *From:* Khoronzhuk, Ivan [[email protected]]
>> *Received:* Thursday, 30 Jan 2014, 6:37am
>> *To:* Shilimkar, Santosh [[email protected]]
>> *CC:* [email protected] [[email protected]];
>> [email protected] [[email protected]];
>> [email protected] [[email protected]]; Khoronzhuk, Ivan
>> [[email protected]]
>> *Subject:* [PATCH] clk: keystone: gate: fix clk_init_data initialization
>>
>> In clk_register_psc() function clk_init_data struct is allocated
>> in the stack. All members of this struct should be initialized
>> before using otherwise it will contain garbage. So initialize flags
>> in this structure too.
>>
>> Signed-off-by: Ivan Khoronzhuk <[email protected]>
>> ---
>> drivers/clk/keystone/gate.c | 1 +
>> 1 file changed, 1 insertion(+)
>>
>> diff --git a/drivers/clk/keystone/gate.c b/drivers/clk/keystone/gate.c
>> index 17a5983..86f1e36 100644
>> --- a/drivers/clk/keystone/gate.c
>> +++ b/drivers/clk/keystone/gate.c
>> @@ -179,6 +179,7 @@ static struct clk *clk_register_psc(struct device *dev,
>>
>> init.name = name;
>> init.ops = &clk_psc_ops;
>> + init.flags = 0;
>> init.parent_names = (parent_name ? &parent_name : NULL);
>> init.num_parents = (parent_name ? 1 : 0);
>>
>> --
>> 1.8.3.2
>>
>

2014-01-30 16:57:14

by Ivan Khoronzhuk

[permalink] [raw]
Subject: Re: [PATCH] clk: keystone: gate: fix clk_init_data initialization

Ok

On 01/30/2014 04:32 PM, Santosh Shilimkar wrote:
> On Thursday 30 January 2014 08:49 AM, Ivan Khoronzhuk wrote:
>> Yes. As result the clk->flag field contains garbage. In my case it leads
>> that flag CLK_IGNORE_UNUSED is set for most of clocks. As result a bunch
>> of unused clocks cannot be disabled.
>>
> Can you please update the change log with above information.
>
>> On 01/30/2014 03:26 PM, Shilimkar, Santosh wrote:
>>> Can u capture the issue withiout this fix?
>>>
>>> Sent from my Android phone using TouchDown (http://www.nitrodesk.com)
>>>
>>> -----Original Message-----
>>> *From:* Khoronzhuk, Ivan [[email protected]]
>>> *Received:* Thursday, 30 Jan 2014, 6:37am
>>> *To:* Shilimkar, Santosh [[email protected]]
>>> *CC:* [email protected] [[email protected]];
>>> [email protected] [[email protected]];
>>> [email protected] [[email protected]]; Khoronzhuk, Ivan
>>> [[email protected]]
>>> *Subject:* [PATCH] clk: keystone: gate: fix clk_init_data initialization
>>>
>>> In clk_register_psc() function clk_init_data struct is allocated
>>> in the stack. All members of this struct should be initialized
>>> before using otherwise it will contain garbage. So initialize flags
>>> in this structure too.
>>>
>>> Signed-off-by: Ivan Khoronzhuk <[email protected]>
>>> ---
>>> drivers/clk/keystone/gate.c | 1 +
>>> 1 file changed, 1 insertion(+)
>>>
>>> diff --git a/drivers/clk/keystone/gate.c b/drivers/clk/keystone/gate.c
>>> index 17a5983..86f1e36 100644
>>> --- a/drivers/clk/keystone/gate.c
>>> +++ b/drivers/clk/keystone/gate.c
>>> @@ -179,6 +179,7 @@ static struct clk *clk_register_psc(struct device *dev,
>>>
>>> init.name = name;
>>> init.ops = &clk_psc_ops;
>>> + init.flags = 0;
>>> init.parent_names = (parent_name ? &parent_name : NULL);
>>> init.num_parents = (parent_name ? 1 : 0);
>>>
>>> --
>>> 1.8.3.2
>>>