linux-serial.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH] drivers/tty/serial: deal with 8250_core.c uninitialized warning for good
@ 2014-02-19 20:00 Paul Gortmaker
  2014-02-19 20:06 ` Jiri Slaby
  2014-02-19 20:51 ` Alan Cox
  0 siblings, 2 replies; 4+ messages in thread
From: Paul Gortmaker @ 2014-02-19 20:00 UTC (permalink / raw)
  To: Greg Kroah-Hartman
  Cc: Jiri Slaby, linux-serial, linux-kernel, Paul Gortmaker, Alan Cox

Every couple of months, someone sends a patch to fix:

drivers/tty/serial/8250/8250_core.c: In function 'serial_unlink_irq_chain':
drivers/tty/serial/8250/8250_core.c:1712:2: warning: 'i' may be used uninitialized in this function [-Wuninitialized]

and they in turn get a NACK for their efforts, and are told that
their compiler is broken.  This has been going on since at least
the year 2008:  https://lkml.org/lkml/2008/11/24/433

Lets add a comment, so that subsequent patches don't get as far as
the maintainers or the mailing lists.

Cc: Alan Cox <alan@linux.intel.com>
Signed-off-by: Paul Gortmaker <paul.gortmaker@windriver.com>

diff --git a/drivers/tty/serial/8250/8250_core.c b/drivers/tty/serial/8250/8250_core.c
index 69932b7556cf..747073b8c38a 100644
--- a/drivers/tty/serial/8250/8250_core.c
+++ b/drivers/tty/serial/8250/8250_core.c
@@ -1694,6 +1694,10 @@ static int serial_link_irq_chain(struct uart_8250_port *up)
 
 static void serial_unlink_irq_chain(struct uart_8250_port *up)
 {
+	/*
+	 * yes, some broken gcc emit "warning: 'i' may be used uninitialized"
+	 * but no, we are not going to take a patch that assigns NULL below.
+	 */
 	struct irq_info *i;
 	struct hlist_node *n;
 	struct hlist_head *h;
-- 
1.8.5.2


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

* Re: [PATCH] drivers/tty/serial: deal with 8250_core.c uninitialized warning for good
  2014-02-19 20:00 [PATCH] drivers/tty/serial: deal with 8250_core.c uninitialized warning for good Paul Gortmaker
@ 2014-02-19 20:06 ` Jiri Slaby
  2014-02-19 20:51 ` Alan Cox
  1 sibling, 0 replies; 4+ messages in thread
From: Jiri Slaby @ 2014-02-19 20:06 UTC (permalink / raw)
  To: Paul Gortmaker, Greg Kroah-Hartman; +Cc: linux-serial, linux-kernel, Alan Cox

On 02/19/2014 09:00 PM, Paul Gortmaker wrote:
> Every couple of months, someone sends a patch to fix:
> 
> drivers/tty/serial/8250/8250_core.c: In function 'serial_unlink_irq_chain':
> drivers/tty/serial/8250/8250_core.c:1712:2: warning: 'i' may be used uninitialized in this function [-Wuninitialized]
> 
> and they in turn get a NACK for their efforts, and are told that
> their compiler is broken.  This has been going on since at least
> the year 2008:  https://lkml.org/lkml/2008/11/24/433
> 
> Lets add a comment, so that subsequent patches don't get as far as
> the maintainers or the mailing lists.

Hi, wouldn't hlist_for_each_entry do a better job to silent both the
compiler and the reporters with the added value of cleanup?

> Cc: Alan Cox <alan@linux.intel.com>
> Signed-off-by: Paul Gortmaker <paul.gortmaker@windriver.com>
> 
> diff --git a/drivers/tty/serial/8250/8250_core.c b/drivers/tty/serial/8250/8250_core.c
> index 69932b7556cf..747073b8c38a 100644
> --- a/drivers/tty/serial/8250/8250_core.c
> +++ b/drivers/tty/serial/8250/8250_core.c
> @@ -1694,6 +1694,10 @@ static int serial_link_irq_chain(struct uart_8250_port *up)
>  
>  static void serial_unlink_irq_chain(struct uart_8250_port *up)
>  {
> +	/*
> +	 * yes, some broken gcc emit "warning: 'i' may be used uninitialized"
> +	 * but no, we are not going to take a patch that assigns NULL below.
> +	 */
>  	struct irq_info *i;
>  	struct hlist_node *n;
>  	struct hlist_head *h;

thanks,
-- 
js
suse labs

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

* Re: [PATCH] drivers/tty/serial: deal with 8250_core.c uninitialized warning for good
  2014-02-19 20:00 [PATCH] drivers/tty/serial: deal with 8250_core.c uninitialized warning for good Paul Gortmaker
  2014-02-19 20:06 ` Jiri Slaby
@ 2014-02-19 20:51 ` Alan Cox
  2014-02-19 21:19   ` Paul Gortmaker
  1 sibling, 1 reply; 4+ messages in thread
From: Alan Cox @ 2014-02-19 20:51 UTC (permalink / raw)
  To: Paul Gortmaker; +Cc: Greg Kroah-Hartman, Jiri Slaby, linux-serial, linux-kernel

On Wed, 2014-02-19 at 15:00 -0500, Paul Gortmaker wrote:
> Every couple of months, someone sends a patch to fix:
> 
> drivers/tty/serial/8250/8250_core.c: In function 'serial_unlink_irq_chain':
> drivers/tty/serial/8250/8250_core.c:1712:2: warning: 'i' may be used uninitialized in this function [-Wuninitialized]
> 
> and they in turn get a NACK for their efforts, and are told that
> their compiler is broken.  This has been going on since at least
> the year 2008:  https://lkml.org/lkml/2008/11/24/433
> 
> Lets add a comment, so that subsequent patches don't get as far as
> the maintainers or the mailing lists.

Are people still using gcc variants that get this wrong ?

Fine by me.

Acked-by: Alan Cox <alan@linux.intel.com>



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

* Re: [PATCH] drivers/tty/serial: deal with 8250_core.c uninitialized warning for good
  2014-02-19 20:51 ` Alan Cox
@ 2014-02-19 21:19   ` Paul Gortmaker
  0 siblings, 0 replies; 4+ messages in thread
From: Paul Gortmaker @ 2014-02-19 21:19 UTC (permalink / raw)
  To: Alan Cox; +Cc: Greg Kroah-Hartman, Jiri Slaby, linux-serial, linux-kernel

On 14-02-19 03:51 PM, Alan Cox wrote:
> On Wed, 2014-02-19 at 15:00 -0500, Paul Gortmaker wrote:
>> Every couple of months, someone sends a patch to fix:
>>
>> drivers/tty/serial/8250/8250_core.c: In function 'serial_unlink_irq_chain':
>> drivers/tty/serial/8250/8250_core.c:1712:2: warning: 'i' may be used uninitialized in this function [-Wuninitialized]
>>
>> and they in turn get a NACK for their efforts, and are told that
>> their compiler is broken.  This has been going on since at least
>> the year 2008:  https://lkml.org/lkml/2008/11/24/433
>>
>> Lets add a comment, so that subsequent patches don't get as far as
>> the maintainers or the mailing lists.
> 
> Are people still using gcc variants that get this wrong ?

It seems that gcc 4.6.3 gets it wrong, and it isn't _that_ old.

Paul.
--

$ mips-linux-gcc -v
Using built-in specs.
COLLECT_GCC=mips-linux-gcc
COLLECT_LTO_WRAPPER=/home/paul/tc/gcc-4.6.3-nolibc/mips-linux/bin/../libexec/gcc/mips-linux/4.6.3/lto-wrapper
Target: mips-linux
Configured with: /home/tony/buildall/src/gcc/configure --target=mips-linux --host=x86_64-linux-gnu --build=x86_64-linux-gnu --enable-targets=all --prefix=/opt/cross/gcc-4.6.3-nolibc/mips-linux/ --enable-languages=c --with-newlib --without-headers --enable-sjlj-exceptions --with-system-libunwind --disable-nls --disable-threads --disable-shared --disable-libmudflap --disable-libssp --disable-libgomp --disable-decimal-float --enable-checking=release --with-mpfr=/home/tony/buildall/src/sys-x86_64 --with-gmp=/home/tony/buildall/src/sys-x86_64 --disable-bootstrap --disable-libquadmath
Thread model: single
gcc version 4.6.3 (GCC) 
$ make allmodconfig > /dev/null
$ make drivers/tty/serial/8250/8250_core.o > /dev/null
drivers/tty/serial/8250/8250_core.c: In function 'serial_unlink_irq_chain':
drivers/tty/serial/8250/8250_core.c:1712:2: warning: 'i' may be used uninitialized in this function [-Wuninitialized]
$ 


> 
> Fine by me.
> 
> Acked-by: Alan Cox <alan@linux.intel.com>
> 
> 

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

end of thread, other threads:[~2014-02-19 21:19 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2014-02-19 20:00 [PATCH] drivers/tty/serial: deal with 8250_core.c uninitialized warning for good Paul Gortmaker
2014-02-19 20:06 ` Jiri Slaby
2014-02-19 20:51 ` Alan Cox
2014-02-19 21:19   ` Paul Gortmaker

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).