Skip to contentSkip to conversation

serial: 8250: fix a sparse warning

PATCH In review Zhang Zhen 2 participants 5 messages Mar 9, 2015 1 message not in the archive TTY layer and serial drivers

lore
Share & tools
lore

A message that is not in the archive (sent off-list or not yet received): [email protected]

Zhang Zhen

author
#1 lore raw

PATCH 1/1 serial: 8250: fix a sparse warning

drivers/tty/serial/8250/8250_core.c: In function ‘serial8250_console_write’:
drivers/tty/serial/8250/8250_core.c:3244: warning: ‘flags’ may be used u unitialized in this function

---
 drivers/tty/serial/8250/8250_core.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
drivers/tty/serial/8250/8250_core.c +1 -1
index deae122..50702e2 100644
@@ -3241,7 +3241,7 @@ serial8250_console_write(struct console *co, const char *s, unsigned int count)
 {
 	struct uart_8250_port *up = &serial8250_ports[co->index];
 	struct uart_port *port = &up->port;
-	unsigned long flags;
+	unsigned long flags = 0;
 	unsigned int ier;
 	int locked = 1;
 
Signature · 4 lines
1.8.5.5


.
maintainer
#2 lore raw
Quoted 14 lines · Zhang Zhen

drivers/tty/serial/8250/8250_core.c: In function ‘serial8250_console_write’:
drivers/tty/serial/8250/8250_core.c:3244: warning: ‘flags’ may be used u unitialized in this function

---
 drivers/tty/serial/8250/8250_core.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
drivers/tty/serial/8250/8250_core.c +0 -0
index deae122..50702e2 100644

drivers/tty/serial/8250/8250_core.c serial8250_console_write(struct console *co, const char *s, unsigned int count) · line 3247

Quoted 8 lines
drivers/tty/serial/8250/8250_core.c +1 -1
@@ -3241,7 +3241,7 @@ serial8250_console_write(struct console *co, const char *s, unsigned int count)
 {
 	struct uart_8250_port *up = &serial8250_ports[co->index];
 	struct uart_port *port = &up->port;
-	unsigned long flags;
+	unsigned long flags = 0;
 	unsigned int ier;
 	int locked = 1;
 

Sparse generated this? Or did a broken / old version of gcc?

This patch fixes nothing, sorry, so I can't accept it.

greg k-h

author
#3 lore raw
Quoted 10 lines · Greg KH
Quoted 9 lines · Zhang Zhen

drivers/tty/serial/8250/8250_core.c: In function ‘serial8250_console_write’:
drivers/tty/serial/8250/8250_core.c:3244: warning: ‘flags’ may be used u unitialized in this function

---
 drivers/tty/serial/8250/8250_core.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
Quoted 16 lines

drivers/tty/serial/8250/8250_core.c serial8250_console_write(struct console *co, const char *s, unsigned int count) · line 3247

Quoted 13 lines
drivers/tty/serial/8250/8250_core.c +1 -1
index deae122..50702e2 100644
@@ -3241,7 +3241,7 @@ serial8250_console_write(struct console *co, const char *s, unsigned int count)
 {
 	struct uart_8250_port *up = &serial8250_ports[co->index];
 	struct uart_port *port = &up->port;
-	unsigned long flags;
+	unsigned long flags = 0;
 	unsigned int ier;
 	int locked = 1;
 

Sparse generated this? Or did a broken / old version of gcc?

Sorry, it's a gcc warning.

My gcc version is:
gcc (SUSE Linux) 4.3.4 [gcc-4_3-branch revision 152973]

Quoted 6 lines

This patch fixes nothing, sorry, so I can't accept it.

greg k-h

.

maintainer
#4 lore raw
Quoted 27 lines · Zhang Zhen
Quoted 10 lines · Greg KH
Quoted 9 lines · Zhang Zhen

drivers/tty/serial/8250/8250_core.c: In function ‘serial8250_console_write’:
drivers/tty/serial/8250/8250_core.c:3244: warning: ‘flags’ may be used u unitialized in this function

---
 drivers/tty/serial/8250/8250_core.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
Quoted 16 lines

drivers/tty/serial/8250/8250_core.c serial8250_console_write(struct console *co, const char *s, unsigned int count) · line 3247

Quoted 13 lines
drivers/tty/serial/8250/8250_core.c +1 -1
index deae122..50702e2 100644
@@ -3241,7 +3241,7 @@ serial8250_console_write(struct console *co, const char *s, unsigned int count)
 {
 	struct uart_8250_port *up = &serial8250_ports[co->index];
 	struct uart_port *port = &up->port;
-	unsigned long flags;
+	unsigned long flags = 0;
 	unsigned int ier;
 	int locked = 1;
 

Sparse generated this? Or did a broken / old version of gcc?

Quoted 4 lines

Sorry, it's a gcc warning.

My gcc version is:
gcc (SUSE Linux) 4.3.4 [gcc-4_3-branch revision 152973]

That's really old and obsolete, please use a modern version of gcc, especially when sending in patches for compiler warnings.

greg k-h

author
#5 lore raw
Quoted 28 lines · Greg KH
Quoted 27 lines · Zhang Zhen
Quoted 26 lines · Greg KH
Quoted 14 lines · Zhang Zhen

drivers/tty/serial/8250/8250_core.c: In function ‘serial8250_console_write’:
drivers/tty/serial/8250/8250_core.c:3244: warning: ‘flags’ may be used u unitialized in this function

---
 drivers/tty/serial/8250/8250_core.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
drivers/tty/serial/8250/8250_core.c +0 -0
index deae122..50702e2 100644

drivers/tty/serial/8250/8250_core.c serial8250_console_write(struct console *co, const char *s, unsigned int count) · line 3247

Quoted 8 lines
drivers/tty/serial/8250/8250_core.c +1 -1
@@ -3241,7 +3241,7 @@ serial8250_console_write(struct console *co, const char *s, unsigned int count)
 {
 	struct uart_8250_port *up = &serial8250_ports[co->index];
 	struct uart_port *port = &up->port;
-	unsigned long flags;
+	unsigned long flags = 0;
 	unsigned int ier;
 	int locked = 1;
 

Sparse generated this? Or did a broken / old version of gcc?

Quoted 8 lines
Quoted 4 lines

Sorry, it's a gcc warning.

My gcc version is:
gcc (SUSE Linux) 4.3.4 [gcc-4_3-branch revision 152973]

That's really old and obsolete, please use a modern version of gcc, especially when sending in patches for compiler warnings.

Ok, thanks!

Quoted 4 lines

greg k-h

.