Message ID | 1358764194-22753-1-git-send-email-sachin.kamat@linaro.org (mailing list archive) |
---|---|
State | Not Applicable, archived |
Headers | show |
Hi, On 21 January 2013 17:15, jonghwan Choi <jhbird.choi@gmail.com> 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@linaro.org>?? ??: >> >> '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@linaro.org> >> Cc: Jonghwan Choi <jhbird.choi@samsung.com> >> --- >> 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@vger.kernel.org >> More majordomo info at http://vger.kernel.org/majordomo-info.html
On Monday, January 21, 2013 03:59:53 PM Sachin Kamat wrote: > '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] I'd prefer these two patches to go through the Exynos tree. Thanks, Rafael > Signed-off-by: Sachin Kamat <sachin.kamat@linaro.org> > Cc: Jonghwan Choi <jhbird.choi@samsung.com> > --- > 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; > >
+cc Kukjin On 22 January 2013 19:29, Rafael J. Wysocki <rjw@sisk.pl> wrote: > On Monday, January 21, 2013 03:59:53 PM Sachin Kamat wrote: >> '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] > > I'd prefer these two patches to go through the Exynos tree. OK. I will post them to the Samsung list. > > Thanks, > Rafael > >
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;
'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@linaro.org> Cc: Jonghwan Choi <jhbird.choi@samsung.com> --- drivers/cpufreq/exynos-cpufreq.c | 6 ++---- 1 files changed, 2 insertions(+), 4 deletions(-)