Skip to contentSkip to conversation

4xx_uart.c: fix GCC 4.6 build warnings

PATCH New Wolfgang Denk 1 participant 2 messages Oct 29, 2011 – Nov 3, 2011 PowerPC

lore
Share & tools
lore
#0 lore raw

PATCH 1/1 4xx_uart.c: fix GCC 4.6 build warnings

Fix:
4xx_uart.c: In function 'get_serial_clock':
4xx_uart.c:204:6: warning: variable 'tmp' set but not used [-Wunused-but-set-variable]

---
 arch/powerpc/cpu/ppc4xx/4xx_uart.c |   26 ++++++++++++++------------
 1 files changed, 14 insertions(+), 12 deletions(-)
arch/powerpc/cpu/ppc4xx/4xx_uart.c +14 -12
index 2660aa8..38ba60b 100644
@@ -200,9 +200,6 @@ int get_serial_clock(void)
 {
 	u32 clk;
 	u32 udiv;
-#if defined(CONFIG_405CR) || defined(CONFIG_405EP) || defined(CONFIG_405GP)
-	u32 tmp;
-#endif
 #if !defined(CONFIG_405EZ)
 	u32 reg;
 #endif
@@ -216,7 +213,6 @@ int get_serial_clock(void)
 	 */
 
 #if defined(CONFIG_405CR) || defined(CONFIG_405GP)
-	tmp = 0;
 	reg = mfdcr(CPC0_CR0) & ~CR0_MASK;
 #ifdef CONFIG_SYS_EXT_SERIAL_CLOCK
 	clk = CONFIG_SYS_EXT_SERIAL_CLOCK;
@@ -227,8 +223,11 @@ int get_serial_clock(void)
 #ifdef CONFIG_SYS_405_UART_ERRATA_59
 	udiv = 31;			/* Errata 59: stuck at 31 */
 #else /* CONFIG_SYS_405_UART_ERRATA_59 */
-	tmp = CONFIG_SYS_BASE_BAUD * 16;
-	udiv = (clk + tmp / 2) / tmp;
+	{
+		u32 tmp = CONFIG_SYS_BASE_BAUD * 16;
+
+		udiv = (clk + tmp / 2) / tmp;
+	}
 	if (udiv > UDIV_MAX)                    /* max. n bits for udiv */
 		udiv = UDIV_MAX;
 #endif /* CONFIG_SYS_405_UART_ERRATA_59 */
@@ -243,12 +242,15 @@ int get_serial_clock(void)
 #endif /* CONFIG_405CR */
 
 #if defined(CONFIG_405EP)
-	reg = mfdcr(CPC0_UCR) & ~(UCR0_MASK | UCR1_MASK);
-	clk = gd->cpu_clk;
-	tmp = CONFIG_SYS_BASE_BAUD * 16;
-	udiv = (clk + tmp / 2) / tmp;
-	if (udiv > UDIV_MAX)                    /* max. n bits for udiv */
-		udiv = UDIV_MAX;
+	{
+		u32 tmp = CONFIG_SYS_BASE_BAUD * 16;
+
+		reg = mfdcr(CPC0_UCR) & ~(UCR0_MASK | UCR1_MASK);
+		clk = gd->cpu_clk;
+		udiv = (clk + tmp / 2) / tmp;
+		if (udiv > UDIV_MAX)                    /* max. n bits for udiv */
+			udiv = UDIV_MAX;
+	}
 	reg |= udiv << UCR0_UDIV_POS;	        /* set the UART divisor */
 	reg |= udiv << UCR1_UDIV_POS;	        /* set the UART divisor */
 	mtdcr(CPC0_UCR, reg);
Signature · 1 line
1.7.6.4
author Applied
#1 lore raw

PATCH 1/1 4xx_uart.c: fix GCC 4.6 build warnings

Dear Wolfgang Denk,

Quoted 10 lines · In message <[email protected]> you wrote:

Fix:
4xx_uart.c: In function 'get_serial_clock':
4xx_uart.c:204:6: warning: variable 'tmp' set but not used [-Wunused-but-set-variable]

---
 arch/powerpc/cpu/ppc4xx/4xx_uart.c |   26 ++++++++++++++------------
 1 files changed, 14 insertions(+), 12 deletions(-)

Applied, thanks.

Best regards,

Wolfgang Denk

Signature · 6 lines
DENX Software Engineering GmbH,     MD: Wolfgang Denk & Detlev Zundel
HRB 165235 Munich, Office: Kirchenstr.5, D-82194 Groebenzell, Germany
Phone: (+49)-8142-66989-10 Fax: (+49)-8142-66989-80 Email: wd at denx.de
"I can call spirits from the vasty deep."
"Why so can I, or so can any man; but will they come when you do call
for them?"          - Shakespeare, 1 King Henry IV, Act III, Scene I.