Skip to contentSkip to conversation

8250: Fix compiler warning

PATCH NAK Kumar Gala 3 participants 5 messages Aug 4, 2011 – Aug 10, 2011

Subsystems (2)
lore
Share & tools
lore

Kumar Gala

author
#0 lore raw

PATCH 1/1 8250: Fix compiler warning

drivers/tty/serial/8250.c: In function 'serial8250_shutdown':
drivers/tty/serial/8250.c:1775:19: warning: 'i' may be used uninitialized in this function

---
 drivers/tty/serial/8250.c |    2 +-
 1 files changed, 1 insertions(+), 1 deletions(-)
drivers/tty/serial/8250.c +1 -1
index f2dfec8..44de222 100644
@@ -1772,7 +1772,7 @@ static int serial_link_irq_chain(struct uart_8250_port *up)
 
 static void serial_unlink_irq_chain(struct uart_8250_port *up)
 {
-	struct irq_info *i;
+	struct irq_info *i = NULL;
 	struct hlist_node *n;
 	struct hlist_head *h;
 
Signature · 1 line
1.7.3.4
#1 lore raw
Quoted 2 lines · On Thu, 4 Aug 2011 03:13:01 -0500 Kumar Gala <[email protected]> wrote:

drivers/tty/serial/8250.c: In function 'serial8250_shutdown':
drivers/tty/serial/8250.c:1775:19: warning: 'i' may be used uninitialized in this function

NAK, as with all the previous nacks of this.

Use a newer gcc - modern gcc gets it right.

author
#2 lore raw
Quoted 9 lines · Alan Cox
Quoted 2 lines · On Thu, 4 Aug 2011 03:13:01 -0500 Kumar Gala <[email protected]> wrote:

drivers/tty/serial/8250.c: In function 'serial8250_shutdown':
drivers/tty/serial/8250.c:1775:19: warning: 'i' may be used uninitialized in this function

NAK, as with all the previous nacks of this.

Use a newer gcc - modern gcc gets it right.

How modern? Building with a gcc 4.5.x

- k

#3 lore raw

Hi Alan,

Quoted 6 lines · Kumar Gala
Quoted 3 lines · Alan Cox

On Thu,  4 Aug 2011 03:13:01 -0500
Kumar Gala <[email protected]> wrote:

Quoted 6 lines
Quoted 6 lines
Quoted 2 lines

drivers/tty/serial/8250.c: In function 'serial8250_shutdown':
drivers/tty/serial/8250.c:1775:19: warning: 'i' may be used uninitialized in this function

NAK, as with all the previous nacks of this.

Use a newer gcc - modern gcc gets it right.

Can we use "uninitialized_var(x)" present in "linux/compiler-gcc.h" in this scenario ?
ie:
struct irq_info *uninitialized_var(i);

Warm Regards,
Maxin

#4 lore raw
In reply to Kumar Gala
Quoted 3 lines
Quoted 1 line

Use a newer gcc - modern gcc gets it right.

How modern? Building with a gcc 4.5.x

4.5.x gets this right on x86 and I don't want to risk hiding a future bug in that area of code with some mindless initialiser hacks.

(OTOH if you can figure a way to restructure that code a bit so its tidy, clear and the compiler gets it right too ...)

Alan