Patchwork [U-Boot,3/4] EXYNOS: CLOCK: Initialised the local variable

login
register
mail settings
Submitter Amar
Date Dec. 5, 2012, 1:31 p.m.
Message ID <1354714297-11568-4-git-send-email-amarendra.xt@samsung.com>
Download mbox | patch
Permalink /patch/203868/
State Changes Requested
Delegated to: Minkyu Kang
Headers show

Comments

Amar - Dec. 5, 2012, 1:31 p.m.
This patch initialises the local variable 'shift' to zero to avoid
improper extraction of ratio and pre-ratio divider values. Extraction of
improper values was happening due to garbage value present in local variable.

Signed-off-by: Amarendra Reddy <amarendra.xt@samsung.com>
---
 arch/arm/cpu/armv7/exynos/clock.c |    4 ++--
 1 files changed, 2 insertions(+), 2 deletions(-)
Jaehoon Chung - Dec. 6, 2012, 4:04 a.m.
Acked-by: Jaehoon Chung <jh80.chung@samsung.com>

On 12/05/2012 10:31 PM, Amar wrote:
> This patch initialises the local variable 'shift' to zero to avoid
> improper extraction of ratio and pre-ratio divider values. Extraction of
> improper values was happening due to garbage value present in local variable.
> 
> Signed-off-by: Amarendra Reddy <amarendra.xt@samsung.com>
> ---
>  arch/arm/cpu/armv7/exynos/clock.c |    4 ++--
>  1 files changed, 2 insertions(+), 2 deletions(-)
> 
> diff --git a/arch/arm/cpu/armv7/exynos/clock.c b/arch/arm/cpu/armv7/exynos/clock.c
> index 731bbff..0bcf05f 100644
> --- a/arch/arm/cpu/armv7/exynos/clock.c
> +++ b/arch/arm/cpu/armv7/exynos/clock.c
> @@ -379,7 +379,7 @@ static unsigned long exynos4_get_mmc_clk(int dev_index)
>  		(struct exynos4_clock *)samsung_get_base_clock();
>  	unsigned long uclk, sclk;
>  	unsigned int sel, ratio, pre_ratio;
> -	int shift;
> +	int shift = 0;
>  
>  	sel = readl(&clk->src_fsys);
>  	sel = (sel >> (dev_index << 2)) & 0xf;
> @@ -428,7 +428,7 @@ static unsigned long exynos5_get_mmc_clk(int dev_index)
>  		(struct exynos5_clock *)samsung_get_base_clock();
>  	unsigned long uclk, sclk;
>  	unsigned int sel, ratio, pre_ratio;
> -	int shift;
> +	int shift = 0;
>  
>  	sel = readl(&clk->src_fsys);
>  	sel = (sel >> (dev_index << 2)) & 0xf;
>

Patch

diff --git a/arch/arm/cpu/armv7/exynos/clock.c b/arch/arm/cpu/armv7/exynos/clock.c
index 731bbff..0bcf05f 100644
--- a/arch/arm/cpu/armv7/exynos/clock.c
+++ b/arch/arm/cpu/armv7/exynos/clock.c
@@ -379,7 +379,7 @@  static unsigned long exynos4_get_mmc_clk(int dev_index)
 		(struct exynos4_clock *)samsung_get_base_clock();
 	unsigned long uclk, sclk;
 	unsigned int sel, ratio, pre_ratio;
-	int shift;
+	int shift = 0;
 
 	sel = readl(&clk->src_fsys);
 	sel = (sel >> (dev_index << 2)) & 0xf;
@@ -428,7 +428,7 @@  static unsigned long exynos5_get_mmc_clk(int dev_index)
 		(struct exynos5_clock *)samsung_get_base_clock();
 	unsigned long uclk, sclk;
 	unsigned int sel, ratio, pre_ratio;
-	int shift;
+	int shift = 0;
 
 	sel = readl(&clk->src_fsys);
 	sel = (sel >> (dev_index << 2)) & 0xf;