Skip to contentSkip to conversation

serial: imx: fix uninitialized variable warning

PATCH New Shawn Guo 2 participants 2 messages Feb 18, 2013

Subsystems (2)
lore
Share & tools
lore

Shawn Guo

author
#0 lore raw

PATCH 1/1 serial: imx: fix uninitialized variable warning

Commit 677fe55 (serial: imx: Fix recursive locking bug) introduces an uninitialized variable warning as below.

CC drivers/tty/serial/imx.o
drivers/tty/serial/imx.c: In function ?imx_console_write?:
include/linux/spinlock.h:340:2: warning: ?flags? may be used uninitialized in this function [-Wuninitialized] drivers/tty/serial/imx.c:1214:16: note: ?flags? was declared here

Initialize the variable to suppress the warning.

---
 drivers/tty/serial/imx.c |    2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
drivers/tty/serial/imx.c +1 -1
index adf7611..147c9e1 100644
@@ -1211,7 +1211,7 @@ imx_console_write(struct console *co, const char *s, unsigned int count)
 	struct imx_port *sport = imx_ports[co->index];
 	struct imx_port_ucrs old_ucr;
 	unsigned int ucr1;
-	unsigned long flags;
+	unsigned long flags = 0;
 	int locked = 1;
 
 	if (sport->port.sysrq)
Signature · 1 line
1.7.9.5
#1 lore raw

PATCH 1/1 serial: imx: fix uninitialized variable warning

Quoted 11 lines · Shawn Guo

Commit 677fe55 (serial: imx: Fix recursive locking bug) introduces an uninitialized variable warning as below.

CC drivers/tty/serial/imx.o
drivers/tty/serial/imx.c: In function ?imx_console_write?:
include/linux/spinlock.h:340:2: warning: ?flags? may be used uninitialized in this function [-Wuninitialized] drivers/tty/serial/imx.c:1214:16: note: ?flags? was declared here

Initialize the variable to suppress the warning.

Thanks

Dirk

Quoted 17 lines
---
 drivers/tty/serial/imx.c |    2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
drivers/tty/serial/imx.c +1 -1
index adf7611..147c9e1 100644
@@ -1211,7 +1211,7 @@ imx_console_write(struct console *co, const char *s, unsigned int count)
 	struct imx_port *sport = imx_ports[co->index];
 	struct imx_port_ucrs old_ucr;
 	unsigned int ucr1;
-	unsigned long flags;
+	unsigned long flags = 0;
 	int locked = 1;
 
 	if (sport->port.sysrq)