[U-Boot] [RFC 1/1] m68k: mfc5227x: do not rely on uninitialized stack values
Heinrich Schuchardt
xypron.glpk at gmx.de
Sun Jul 30 18:59:27 UTC 2017
The behavior get_clocks depends on the unitialized
value of bootmode.
By setting it to zero we get a defined behavior and
can get rid of superfluos coding.
The problem was indicated by cppcheck.
Signed-off-by: Heinrich Schuchardt <xypron.glpk at gmx.de>
---
I have no hardware to test this.
Please, check thorougly before merging.
---
---
arch/m68k/cpu/mcf5227x/speed.c | 10 ++--------
1 file changed, 2 insertions(+), 8 deletions(-)
diff --git a/arch/m68k/cpu/mcf5227x/speed.c b/arch/m68k/cpu/mcf5227x/speed.c
index 44de4a6701..978cc7adc6 100644
--- a/arch/m68k/cpu/mcf5227x/speed.c
+++ b/arch/m68k/cpu/mcf5227x/speed.c
@@ -73,14 +73,8 @@ int get_clocks(void)
ccm_t *ccm = (ccm_t *)MMAP_CCM;
pll_t *pll = (pll_t *)MMAP_PLL;
- int vco, temp, pcrvalue, pfdr;
- u8 bootmode;
-
- pcrvalue = in_be32(&pll->pcr) & 0xFF0F0FFF;
- pfdr = pcrvalue >> 24;
-
- if (pfdr == 0x1E)
- bootmode = 0; /* Normal Mode */
+ int vco, temp, pcrvalue;
+ u8 bootmode = 0; /* Normal Mode */;
#ifdef CONFIG_CF_SBF
bootmode = 3; /* Serial Mode */
--
2.13.2
More information about the U-Boot
mailing list