diff mbox

[U-Boot,RFC,1/1] m68k: mfc5227x: do not rely on uninitialized stack values

Message ID 20170730185927.9770-1-xypron.glpk@gmx.de
State Deferred
Delegated to: Jason Jin
Headers show

Commit Message

Heinrich Schuchardt July 30, 2017, 6:59 p.m. UTC
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@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 mbox

Patch

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 */