linux-serial.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH] serial: 8250: fix uninitialized compiler warning
@ 2010-11-09 16:55 Davidlohr Bueso
  2010-11-09 17:01 ` Randy Dunlap
  2010-11-09 18:33 ` Alan Cox
  0 siblings, 2 replies; 4+ messages in thread
From: Davidlohr Bueso @ 2010-11-09 16:55 UTC (permalink / raw)
  To: Greg Kroah-Hartman; +Cc: LKML, linux-kbuild, linux-serial

From: Davidlohr Bueso <dave@gnu.org>

This addresses:

  CC [M]  drivers/serial/8250.o
drivers/serial/8250.c: In function ‘serial8250_shutdown’:
drivers/serial/8250.c:1696: warning: ‘i’ may be used uninitialized in this function
drivers/serial/8250.c:1696: note: ‘i’ was declared here

Signed-off-by: Davidlohr Bueso <dave@gnu.org>
---
 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 4d8e14b..f734eee 100644
--- a/drivers/serial/8250.c
+++ b/drivers/serial/8250.c
@@ -1693,7 +1693,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;
 
-- 
1.7.1

^ permalink raw reply related	[flat|nested] 4+ messages in thread

* Re: [PATCH] serial: 8250: fix uninitialized compiler warning
  2010-11-09 16:55 [PATCH] serial: 8250: fix uninitialized compiler warning Davidlohr Bueso
@ 2010-11-09 17:01 ` Randy Dunlap
  2010-11-09 18:33 ` Alan Cox
  1 sibling, 0 replies; 4+ messages in thread
From: Randy Dunlap @ 2010-11-09 17:01 UTC (permalink / raw)
  To: dave; +Cc: Greg Kroah-Hartman, LKML, linux-kbuild, linux-serial

On Tue, 09 Nov 2010 13:55:23 -0300 Davidlohr Bueso wrote:

> From: Davidlohr Bueso <dave@gnu.org>
> 
> This addresses:
> 
>   CC [M]  drivers/serial/8250.o
> drivers/serial/8250.c: In function ‘serial8250_shutdown’:
> drivers/serial/8250.c:1696: warning: ‘i’ may be used uninitialized in this function
> drivers/serial/8250.c:1696: note: ‘i’ was declared here

so in your analysis of this compiler warning, was the warning correct & justified,
or was it false?  I.e., is the init to NULL needed?

If it was false, could we just quieten the warning by using:

	struct irq_info *unitialized_var(i);

plus #include <linux/compiler.h> ?


> Signed-off-by: Davidlohr Bueso <dave@gnu.org>
> ---
>  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 4d8e14b..f734eee 100644
> --- a/drivers/serial/8250.c
> +++ b/drivers/serial/8250.c
> @@ -1693,7 +1693,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;
>  
> -- 


---
~Randy
*** Remember to use Documentation/SubmitChecklist when testing your code ***
--
To unsubscribe from this list: send the line "unsubscribe linux-serial" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html

^ permalink raw reply	[flat|nested] 4+ messages in thread

* Re: [PATCH] serial: 8250: fix uninitialized compiler warning
  2010-11-09 16:55 [PATCH] serial: 8250: fix uninitialized compiler warning Davidlohr Bueso
  2010-11-09 17:01 ` Randy Dunlap
@ 2010-11-09 18:33 ` Alan Cox
  2010-11-09 18:54   ` Davidlohr Bueso
  1 sibling, 1 reply; 4+ messages in thread
From: Alan Cox @ 2010-11-09 18:33 UTC (permalink / raw)
  To: dave; +Cc: Greg Kroah-Hartman, LKML, linux-kbuild, linux-serial

On Tue, 09 Nov 2010 13:55:23 -0300
Davidlohr Bueso <dave@gnu.org> wrote:

> From: Davidlohr Bueso <dave@gnu.org>
> 
> This addresses:
> 
>   CC [M]  drivers/serial/8250.o
> drivers/serial/8250.c: In function ‘serial8250_shutdown’:
> drivers/serial/8250.c:1696: warning: ‘i’ may be used uninitialized in this function
> drivers/serial/8250.c:1696: note: ‘i’ was declared here

NAK - pleass see the four or five previous discussions on this one.

The current compilers all seem to get it right anyway.

Alan
--
To unsubscribe from this list: send the line "unsubscribe linux-serial" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html

^ permalink raw reply	[flat|nested] 4+ messages in thread

* Re: [PATCH] serial: 8250: fix uninitialized compiler warning
  2010-11-09 18:33 ` Alan Cox
@ 2010-11-09 18:54   ` Davidlohr Bueso
  0 siblings, 0 replies; 4+ messages in thread
From: Davidlohr Bueso @ 2010-11-09 18:54 UTC (permalink / raw)
  To: Alan Cox; +Cc: Greg Kroah-Hartman, LKML, linux-kbuild, linux-serial

On Tue, 2010-11-09 at 18:33 +0000, Alan Cox wrote:
> On Tue, 09 Nov 2010 13:55:23 -0300
> Davidlohr Bueso <dave@gnu.org> wrote:
> 
> > From: Davidlohr Bueso <dave@gnu.org>
> > 
> > This addresses:
> > 
> >   CC [M]  drivers/serial/8250.o
> > drivers/serial/8250.c: In function ‘serial8250_shutdown’:
> > drivers/serial/8250.c:1696: warning: ‘i’ may be used uninitialized in this function
> > drivers/serial/8250.c:1696: note: ‘i’ was declared here
> 
> NAK - pleass see the four or five previous discussions on this one.
> 
Yes I should have googled this one before sending.

> The current compilers all seem to get it right anyway.

This is with gcc 4.4.5 (ubuntu 10.10 - latest), released on October 1st,
2010 (quite current).

Thanks,
Davidlohr


--
To unsubscribe from this list: send the line "unsubscribe linux-serial" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html

^ permalink raw reply	[flat|nested] 4+ messages in thread

end of thread, other threads:[~2010-11-09 18:54 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2010-11-09 16:55 [PATCH] serial: 8250: fix uninitialized compiler warning Davidlohr Bueso
2010-11-09 17:01 ` Randy Dunlap
2010-11-09 18:33 ` Alan Cox
2010-11-09 18:54   ` Davidlohr Bueso

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).