From: David Howells <dhowells@redhat.com>
To: linux-serial@vger.kernel.org, akpm@linux-foundation.org
Cc: alan@lxorguk.ukuu.org.uk, dhowells@redhat.com,
linux-kernel@vger.kernel.org
Subject: [PATCH] Fix an uninitialised variable warning in the 8250 driver
Date: Fri, 14 Nov 2008 16:20:38 +0000 [thread overview]
Message-ID: <20081114162038.23016.20581.stgit@warthog.procyon.org.uk> (raw)
Fix an uninitialised variable warning in the 8250 driver:
CC drivers/serial/8250.o
drivers/serial/8250.c: In function 'serial8250_shutdown':
drivers/serial/8250.c:1612: warning: 'i' may be used uninitialized in this function
This has the added advantage of removing a conditional test from the main path
as the BUG_ON() that indicated the loop dropped off the end is now bypassed in
the event of a successful search. Indeed that BUG_ON() can now be a BUG() as
the only way to reach it automatically makes its condition true.
Signed-off-by: David Howells <dhowells@redhat.com>
---
drivers/serial/8250.c | 5 +++--
1 files changed, 3 insertions(+), 2 deletions(-)
diff --git a/drivers/serial/8250.c b/drivers/serial/8250.c
index 303272a..62cf7e5 100644
--- a/drivers/serial/8250.c
+++ b/drivers/serial/8250.c
@@ -1620,10 +1620,11 @@ static void serial_unlink_irq_chain(struct uart_8250_port *up)
hlist_for_each(n, h) {
i = hlist_entry(n, struct irq_info, node);
if (i->irq == up->port.irq)
- break;
+ goto found;
}
+ BUG();
- BUG_ON(n == NULL);
+found:
BUG_ON(i->head == NULL);
if (list_empty(i->head))
next reply other threads:[~2008-11-14 16:20 UTC|newest]
Thread overview: 4+ messages / expand[flat|nested] mbox.gz Atom feed top
2008-11-14 16:20 David Howells [this message]
2008-11-14 16:34 ` [PATCH] Fix an uninitialised variable warning in the 8250 driver Alan Cox
2008-11-14 16:51 ` David Howells
2008-11-14 19:01 ` Alan Cox
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20081114162038.23016.20581.stgit@warthog.procyon.org.uk \
--to=dhowells@redhat.com \
--cc=akpm@linux-foundation.org \
--cc=alan@lxorguk.ukuu.org.uk \
--cc=linux-kernel@vger.kernel.org \
--cc=linux-serial@vger.kernel.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox