Skip to contentSkip to conversation

Fix the warning of uninitialized value in driver/serial/8250.c

PATCH NAK Wenji Huang 3 participants 4 messages Feb 2, 2009 – Feb 3, 2009 TTY layer and serial drivers

lore
Share & tools
lore
#0 lore raw

PATCH 1/1 Fix the warning of uninitialized value in driver/serial/8250.c

This patch is to remove the the warning of uninitialized i in driver/serial/8250.c

serial/8250.c 2009-02-02 14:03:30.000000000 -0500 renamed from serial/8250.c.Orig 2009-02-02 14:02:47.000000000 -0500 +1 -1
diff -Nurh drivers/serial/8250.c.Orig drivers/serial/8250.c
@@ -1678,7 +1678,7 @@
 
 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;
 
#1 lore raw
Quoted 9 lines · On Monday 02 February 2009 10:10:06 Wenji Huang wrote:

This patch is to remove the the warning of uninitialized i in driver/serial/8250.c

diff -Nurh drivers/serial/8250.c.Orig drivers/serial/8250.c

serial/8250.c 2009-02-02 14:03:30.000000000 -0500 line 1683

Quoted 7 lines
serial/8250.c 2009-02-02 14:03:30.000000000 -0500 renamed from serial/8250.c.Orig 2009-02-02 14:02:47.000000000 -0500 +1 -1
@@ -1678,7 +1678,7 @@
 
  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;

gcc is wrong, i can't be used uninitialized in that function. You should use the following construct instead to suppress the warning without generating any code.

	struct irq_info *uninitialized_var(i);

Best regards,

Signature · 9 lines
Laurent Pinchart
CSE Semaphore Belgium

Chaussee de Bruxelles, 732A
B-1410 Waterloo
Belgium

T +32 (2) 387 42 59
F +32 (2) 387 42 75
#2 lore raw
Quoted 3 lines

gcc is wrong, i can't be used uninitialized in that function. You should use the following construct instead to suppress the warning without generating any code.

No need for that either - newer gcc gets it right.