[PATCH] drivers/serial/8250.c: 'i' may be used uninitialized

Previous message: [thread] [date] [author]
Next message: [thread] [date] [author]
From: Steven Noonan
Date: Wednesday, October 1, 2008 - 1:47 am

serial_unlink_irq_chain() does not initialize iterator 'i', and that is
correct logically because it is always initialized, either in the
hlist_for_each or in the conditional immediately after (which fires if
hlist_for_each comes up empty-handed). GCC does not realize this
connection and emits a false warning. Annotate it with uninitialized_var().

Signed-off-by: Steven Noonan <steven@uplinklabs.net>
---
 drivers/serial/8250.c |    2 +-
 1 files changed, 1 insertions(+), 1 deletions(-)

diff --git a/drivers/serial/8250.c b/drivers/serial/8250.c
index 356c2a2..4950ee5 100644
--- a/drivers/serial/8250.c
+++ b/drivers/serial/8250.c
@@ -1551,7 +1551,7 @@ static int serial_link_irq_chain(struct uart_8250_port *up)
 {
 	struct hlist_head *h;
 	struct hlist_node *n;
-	struct irq_info *i;
+	struct irq_info *uninitialized_var(i);
 	int ret, irq_flags = up->port.flags & UPF_SHARE_IRQ ? IRQF_SHARED : 0;
 
 	mutex_lock(&hash_mutex);
-- 
1.6.0.2

--
Previous message: [thread] [date] [author]
Next message: [thread] [date] [author]

Messages in current thread:
[PATCH -tip] pcm_native: label out defined but not used, Steven Noonan, (Wed Oct 1, 12:57 am)
[PATCH -tip] sdhci: 'scratch' may be used uninitialized, Steven Noonan, (Wed Oct 1, 12:57 am)
[PATCH -tip] pcm_native: label out defined but not used, Steven Noonan, (Wed Oct 1, 1:12 am)
[PATCH -tip] sdhci: 'scratch' may be used uninitialized, Steven Noonan, (Wed Oct 1, 1:14 am)
[PATCH] drivers/serial/8250.c: 'i' may be used uninitialized, Steven Noonan, (Wed Oct 1, 1:47 am)
[PATCH] sdhci: 'scratch' may be used uninitialized, Steven Noonan, (Wed Oct 1, 1:50 am)
Re: [PATCH] sdhci: 'scratch' may be used uninitialized, Pierre Ossman, (Sat Oct 4, 12:57 pm)
Re: [PATCH] sdhci: 'scratch' may be used uninitialized, Steven Noonan, (Sun Oct 5, 3:53 pm)
Re: [PATCH] sdhci: 'scratch' may be used uninitialized, Steven Noonan, (Sun Oct 5, 4:48 pm)
Re: [PATCH] sdhci: 'scratch' may be used uninitialized, Adrian Bunk, (Sun Oct 5, 10:59 pm)
Re: [PATCH] sdhci: 'scratch' may be used uninitialized, Ingo Molnar, (Sun Oct 5, 11:30 pm)
Re: [PATCH] sdhci: 'scratch' may be used uninitialized, Pierre Ossman, (Mon Oct 6, 12:27 am)