All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH 1/1] Char: cyclades, fix compiler warning
       [not found] <20091114080505.7715b022.akpm@linux-foundation.org>
@ 2009-11-18 12:18 ` Jiri Slaby
  2009-11-20 17:43   ` Greg KH
  0 siblings, 1 reply; 3+ messages in thread
From: Jiri Slaby @ 2009-11-18 12:18 UTC (permalink / raw)
  To: akpm; +Cc: linux-kernel, Alan Cox, Greg Kroah-Hartman

With gcc 4.0.2:
drivers/char/cyclades.c: In function 'cyy_interrupt':
drivers/char/cyclades.c:581: warning: 'info' may be used uninitialized in this function

introduced by

: commit 3aeea5b92210083c7cffd4f08a0bb141d3f2d574
: Author:     Jiri Slaby <jirislaby@gmail.com>
: AuthorDate: Sat Sep 19 13:13:16 2009 -0700
: Commit:     Live-CD User <linux@linux.site>
: CommitDate: Sat Sep 19 13:13:16 2009 -0700
:
:    cyclades: introduce cyy_readb/writeb

In fact the true branch which uses uninitialized 'info' can never
happen because chip is always less than ->nchips and channel is
always less than 4 which we alloc.

So behave similar to rx handling and remove the test completely.

I wonder why gcc 4.4.1 doesn't spit a word.

Reported-by: Andrew Morton <akpm@linux-foundation.org>
Cc: Alan Cox <alan@linux.intel.com>
Cc: Greg Kroah-Hartman <gregkh@suse.de>
Signed-off-by: Jiri Slaby <jslaby@novell.com>
---
 drivers/char/cyclades.c |    8 +-------
 1 files changed, 1 insertions(+), 7 deletions(-)

diff --git a/drivers/char/cyclades.c b/drivers/char/cyclades.c
index a188c05..e026f24 100644
--- a/drivers/char/cyclades.c
+++ b/drivers/char/cyclades.c
@@ -595,14 +595,8 @@ static void cyy_chip_tx(struct cyclades_card *cinfo, unsigned int chip,
 	channel = save_xir & CyIRChannel;
 	save_car = readb(base_addr + (CyCAR << index));
 	cy_writeb(base_addr + (CyCAR << index), save_xir);
-	info = &cinfo->ports[channel + chip * 4];
 
-	/* validate the port# (as configured and open) */
-	if (channel + chip * 4 >= cinfo->nports) {
-		cy_writeb(base_addr + (CySRER << index),
-			  readb(base_addr + (CySRER << index)) & ~CyTxRdy);
-		goto end;
-	}
+	info = &cinfo->ports[channel + chip * 4];
 	tty = tty_port_tty_get(&info->port);
 	if (tty == NULL) {
 		cyy_writeb(info, CySRER, cyy_readb(info, CySRER) & ~CyTxRdy);
-- 
1.6.4.2


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

* Re: [PATCH 1/1] Char: cyclades, fix compiler warning
  2009-11-18 12:18 ` [PATCH 1/1] Char: cyclades, fix compiler warning Jiri Slaby
@ 2009-11-20 17:43   ` Greg KH
  2009-11-20 23:51     ` Andrew Morton
  0 siblings, 1 reply; 3+ messages in thread
From: Greg KH @ 2009-11-20 17:43 UTC (permalink / raw)
  To: Jiri Slaby; +Cc: akpm, linux-kernel, Alan Cox, Greg Kroah-Hartman

On Wed, Nov 18, 2009 at 01:18:22PM +0100, Jiri Slaby wrote:
> With gcc 4.0.2:
> drivers/char/cyclades.c: In function 'cyy_interrupt':
> drivers/char/cyclades.c:581: warning: 'info' may be used uninitialized in this function
> 
> introduced by
> 
> : commit 3aeea5b92210083c7cffd4f08a0bb141d3f2d574
> : Author:     Jiri Slaby <jirislaby@gmail.com>
> : AuthorDate: Sat Sep 19 13:13:16 2009 -0700
> : Commit:     Live-CD User <linux@linux.site>
> : CommitDate: Sat Sep 19 13:13:16 2009 -0700
> :
> :    cyclades: introduce cyy_readb/writeb
> 
> In fact the true branch which uses uninitialized 'info' can never
> happen because chip is always less than ->nchips and channel is
> always less than 4 which we alloc.
> 
> So behave similar to rx handling and remove the test completely.
> 
> I wonder why gcc 4.4.1 doesn't spit a word.
> 
> Reported-by: Andrew Morton <akpm@linux-foundation.org>
> Cc: Alan Cox <alan@linux.intel.com>
> Cc: Greg Kroah-Hartman <gregkh@suse.de>
> Signed-off-by: Jiri Slaby <jslaby@novell.com>
> ---
>  drivers/char/cyclades.c |    8 +-------
>  1 files changed, 1 insertions(+), 7 deletions(-)
> 
> diff --git a/drivers/char/cyclades.c b/drivers/char/cyclades.c
> index a188c05..e026f24 100644
> --- a/drivers/char/cyclades.c
> +++ b/drivers/char/cyclades.c
> @@ -595,14 +595,8 @@ static void cyy_chip_tx(struct cyclades_card *cinfo, unsigned int chip,
>  	channel = save_xir & CyIRChannel;
>  	save_car = readb(base_addr + (CyCAR << index));
>  	cy_writeb(base_addr + (CyCAR << index), save_xir);
> -	info = &cinfo->ports[channel + chip * 4];
>  
> -	/* validate the port# (as configured and open) */
> -	if (channel + chip * 4 >= cinfo->nports) {
> -		cy_writeb(base_addr + (CySRER << index),
> -			  readb(base_addr + (CySRER << index)) & ~CyTxRdy);
> -		goto end;
> -	}
> +	info = &cinfo->ports[channel + chip * 4];

Wierd, but this doesn't apply at all to my or Linus's tree.  Are there
some other cyclades patch floating around out there that is needed here
before this one?

thanks,

greg k-h

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

* Re: [PATCH 1/1] Char: cyclades, fix compiler warning
  2009-11-20 17:43   ` Greg KH
@ 2009-11-20 23:51     ` Andrew Morton
  0 siblings, 0 replies; 3+ messages in thread
From: Andrew Morton @ 2009-11-20 23:51 UTC (permalink / raw)
  To: Greg KH; +Cc: Jiri Slaby, linux-kernel, Alan Cox, Greg Kroah-Hartman

On Fri, 20 Nov 2009 09:43:28 -0800
Greg KH <greg@kroah.com> wrote:

> > diff --git a/drivers/char/cyclades.c b/drivers/char/cyclades.c
> > index a188c05..e026f24 100644
> > --- a/drivers/char/cyclades.c
> > +++ b/drivers/char/cyclades.c
> > @@ -595,14 +595,8 @@ static void cyy_chip_tx(struct cyclades_card *cinfo, unsigned int chip,
> >  	channel = save_xir & CyIRChannel;
> >  	save_car = readb(base_addr + (CyCAR << index));
> >  	cy_writeb(base_addr + (CyCAR << index), save_xir);
> > -	info = &cinfo->ports[channel + chip * 4];
> >  
> > -	/* validate the port# (as configured and open) */
> > -	if (channel + chip * 4 >= cinfo->nports) {
> > -		cy_writeb(base_addr + (CySRER << index),
> > -			  readb(base_addr + (CySRER << index)) & ~CyTxRdy);
> > -		goto end;
> > -	}
> > +	info = &cinfo->ports[channel + chip * 4];
> 
> Wierd, but this doesn't apply at all to my or Linus's tree.  Are there
> some other cyclades patch floating around out there that is needed here
> before this one?

Jiri's patch is based on top of my initial half-assed fix.  Against
mainline:

From: Jiri Slaby <jslaby@novell.com>

With gcc 4.0.2:
drivers/char/cyclades.c: In function 'cyy_interrupt':
drivers/char/cyclades.c:581: warning: 'info' may be used uninitialized in this function

introduced by

: commit 3aeea5b92210083c7cffd4f08a0bb141d3f2d574
: Author:     Jiri Slaby <jirislaby@gmail.com>
: AuthorDate: Sat Sep 19 13:13:16 2009 -0700
: Commit:     Live-CD User <linux@linux.site>
: CommitDate: Sat Sep 19 13:13:16 2009 -0700
:
:    cyclades: introduce cyy_readb/writeb

In fact the true branch which uses uninitialized 'info' can never
happen because chip is always less than ->nchips and channel is
always less than 4 which we alloc.

So behave similar to rx handling and remove the test completely.

I wonder why gcc 4.4.1 doesn't spit a word.

Reported-by: Andrew Morton <akpm@linux-foundation.org>
Cc: Alan Cox <alan@linux.intel.com>
Cc: Greg Kroah-Hartman <gregkh@suse.de>
Signed-off-by: Jiri Slaby <jslaby@novell.com>
Signed-off-by: Andrew Morton <akpm@linux-foundation.org>
---

 drivers/char/cyclades.c |    6 ------
 1 file changed, 6 deletions(-)

diff -puN drivers/char/cyclades.c~char-cyclades-fix-compiler-warning drivers/char/cyclades.c
--- a/drivers/char/cyclades.c~char-cyclades-fix-compiler-warning
+++ a/drivers/char/cyclades.c
@@ -598,12 +598,6 @@ static void cyy_chip_tx(struct cyclades_
 	save_car = readb(base_addr + (CyCAR << index));
 	cy_writeb(base_addr + (CyCAR << index), save_xir);
 
-	/* validate the port# (as configured and open) */
-	if (channel + chip * 4 >= cinfo->nports) {
-		cy_writeb(base_addr + (CySRER << index),
-			  readb(base_addr + (CySRER << index)) & ~CyTxRdy);
-		goto end;
-	}
 	info = &cinfo->ports[channel + chip * 4];
 	tty = tty_port_tty_get(&info->port);
 	if (tty == NULL) {
_


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

end of thread, other threads:[~2009-11-20 23:51 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
     [not found] <20091114080505.7715b022.akpm@linux-foundation.org>
2009-11-18 12:18 ` [PATCH 1/1] Char: cyclades, fix compiler warning Jiri Slaby
2009-11-20 17:43   ` Greg KH
2009-11-20 23:51     ` Andrew Morton

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.