Re: [PATCH 1/2] cpufreq: exynos: Initialise return variable

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



Hi,
On 21 January 2013 17:15, jonghwan Choi <jhbird.choi@xxxxxxxxx> wrote:
> Hi.
> I already send a patch to fix it.
> But i set the 0 as a initial value.
> Because i thought that
>
> if (frequeny_locked)
>      goto out; “
> is not a error case.
> How about your opinion?

I thought it was an error condition and hence assigned -EINVAL.
If it is not then 0 should be good enough as it represents success for
that function.

>
> 2013. 1. 21. 오후 7:38에 "Sachin Kamat" <sachin.kamat@xxxxxxxxxx>님이 작성:
>>
>> 'ret' is undefined when the function returns from the first
>> error condition. Without this patch we get the following warning:
>>
>> drivers/cpufreq/exynos-cpufreq.c: In function ‘exynos_target’:
>> drivers/cpufreq/exynos-cpufreq.c:182:2: warning:
>> ‘ret’ may be used uninitialized in this function [-Wuninitialized]
>>
>> Signed-off-by: Sachin Kamat <sachin.kamat@xxxxxxxxxx>
>> Cc: Jonghwan Choi <jhbird.choi@xxxxxxxxxxx>
>> ---
>>  drivers/cpufreq/exynos-cpufreq.c |    6 ++----
>>  1 files changed, 2 insertions(+), 4 deletions(-)
>>
>> diff --git a/drivers/cpufreq/exynos-cpufreq.c
>> b/drivers/cpufreq/exynos-cpufreq.c
>> index 218b3ce..38c6158 100644
>> --- a/drivers/cpufreq/exynos-cpufreq.c
>> +++ b/drivers/cpufreq/exynos-cpufreq.c
>> @@ -159,7 +159,7 @@ static int exynos_target(struct cpufreq_policy
>> *policy,
>>  {
>>         struct cpufreq_frequency_table *freq_table =
>> exynos_info->freq_table;
>>         unsigned int index;
>> -       int ret;
>> +       int ret = -EINVAL;
>>
>>         mutex_lock(&cpufreq_lock);
>>
>> @@ -167,10 +167,8 @@ static int exynos_target(struct cpufreq_policy
>> *policy,
>>                 goto out;
>>
>>         if (cpufreq_frequency_table_target(policy, freq_table,
>> -                                          target_freq, relation, &index))
>> {
>> -               ret = -EINVAL;
>> +                                          target_freq, relation, &index))
>>                 goto out;
>> -       }
>>
>>         freqs.new = freq_table[index].frequency;
>>
>> --
>> 1.7.4.1
>>
>> --
>> To unsubscribe from this list: send the line "unsubscribe cpufreq" in
>> the body of a message to majordomo@xxxxxxxxxxxxxxx
>> More majordomo info at  http://vger.kernel.org/majordomo-info.html



-- 
With warm regards,
Sachin
--
To unsubscribe from this list: send the line "unsubscribe cpufreq" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at  http://vger.kernel.org/majordomo-info.html


[Index of Archives]     [Linux Kernel Devel]     [Linux USB Devel]     [Linux Audio Users]     [Yosemite Forum]     [Linux SCSI]

  Powered by Linux