public inbox for linux-serial@vger.kernel.org
 help / color / mirror / Atom feed
From: Sheng Yang <sheng@linux.intel.com>
To: Alan Cox <alan@lxorguk.ukuu.org.uk>
Cc: linux-kernel@vger.kernel.org, linux-serial@vger.kernel.org
Subject: Re: [PATCH] 8250: Eliminate compile warning of 8250.c
Date: Tue, 25 Nov 2008 18:31:33 +0800	[thread overview]
Message-ID: <200811251831.34737.sheng@linux.intel.com> (raw)
In-Reply-To: <20081125102230.791fa168@lxorguk.ukuu.org.uk>

On Tuesday 25 November 2008 18:22:30 Alan Cox wrote:
> On Tue, 25 Nov 2008 11:58:23 +0800
>
> Sheng Yang <sheng@linux.intel.com> wrote:
> > (Something wrong with encoding of the first mail...)
> >
> > The patch based on linux-2.6 upstream and elimiate this compile warning
> > info:
> >
> > drivers/serial/8250.c: In function 'serial8250_shutdown':
> > drivers/serial/8250.c:1612: warning: 'i' may be used uninitialized in
> > this function
>
> NAK - again.
>
> There is no real bug here and you risk hiding future ones. It also
> doesn't produce a warning with a modern gcc.

Can't understand initializing got "risk hiding future ones". As I know, didn't 
initialize the variable got risk hiding future random problems. If you think 
i=NULL is not enough, how about this? I don't use this version just because I 
think BUG_ON(n==null) cover this. And I don't think leave it to compiler is 
more proper here.

--
From: Sheng Yang <sheng@linux.intel.com>
Date: Tue, 25 Nov 2008 18:25:26 +0800
Subject: [PATCH 1/1] 8250: Eliminate compile warning of 8250.c

The patch based on linux-2.6 upstream and elimiate this compile warning
info:

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

Signed-off-by: Sheng Yang <sheng@linux.intel.com>
---
 drivers/serial/8250.c |    3 ++-
 1 files changed, 2 insertions(+), 1 deletions(-)

diff --git a/drivers/serial/8250.c b/drivers/serial/8250.c
index 303272a..c3120be 100644
--- a/drivers/serial/8250.c
+++ b/drivers/serial/8250.c
@@ -1609,7 +1609,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;
 
@@ -1624,6 +1624,7 @@ static void serial_unlink_irq_chain(struct 
uart_8250_port *up)
 	}
 
 	BUG_ON(n == NULL);
+	BUG_ON(i == NULL);
 	BUG_ON(i->head == NULL);
 
 	if (list_empty(i->head))
-- 
1.5.4.5





  reply	other threads:[~2008-11-25 10:35 UTC|newest]

Thread overview: 9+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2008-11-25  3:55 [PATCH] 8250: Eliminate compile warning of 8250.c Sheng Yang
2008-11-25  3:58 ` Sheng Yang
2008-11-25 10:22   ` Alan Cox
2008-11-25 10:31     ` Sheng Yang [this message]
2008-11-25 10:43       ` Alan Cox
2008-11-25 10:51         ` Sheng Yang
2008-11-25 11:12           ` Olivier Galibert
2008-11-25 11:13           ` Alan Cox
2008-11-25 11:32             ` Sheng Yang

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=200811251831.34737.sheng@linux.intel.com \
    --to=sheng@linux.intel.com \
    --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