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

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

 



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@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;
>  
> 
-- 
I speak only for myself.
Rafael J. Wysocki, Intel Open Source Technology Center.
--
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