Char: cyclades, fix compiler warning
A message that is not in the archive (sent off-list or not yet received): [email protected]
PATCH 1/1 Char: cyclades, fix compiler warning
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 <[email protected]>
: AuthorDate: Sat Sep 19 13:13:16 2009 -0700
: Commit: Live-CD User <[email protected]>
: 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.
--- drivers/char/cyclades.c | 8 +------- 1 files changed, 1 insertions(+), 7 deletions(-)
drivers/char/cyclades.c +1 -7
@@ -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);
Signature · 1 line
1.6.4.2
Quoted 37 lines · Jiri Slaby
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 functionintroduced by
: commit
3aeea5b92210083c7cffd4f08a0bb141d3f2d574
: Author: Jiri Slaby <[email protected]>
: AuthorDate: Sat Sep 19 13:13:16 2009 -0700
: Commit: Live-CD User <[email protected]>
: CommitDate: Sat Sep 19 13:13:16 2009 -0700
:
: cyclades: introduce cyy_readb/writebIn 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 <[email protected]>Cc Alan Cox <[email protected]>Cc Greg Kroah-Hartman <[email protected]>Signed-off-by Jiri Slaby <[email protected]>--- drivers/char/cyclades.c | 8 +------- 1 files changed, 1 insertions(+), 7 deletions(-)drivers/char/cyclades.c +0
-0@@ -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));
drivers/char/cyclades.c static void cyy_chip_tx(struct cyclades_card *cinfo, unsigned int chip, · line 599
Quoted 10 lines
drivers/char/cyclades.c +1
-7cy_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
Quoted 10 lines · On Fri, 20 Nov 2009 09:43:28 -0800 Greg KH <[email protected]> wrote:
Quoted 10 lines
drivers/char/cyclades.c +0
-1@@ -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 ];
Quoted 11 lines
drivers/char/cyclades.c static void cyy_chip_tx(struct cyclades_card *cinfo, unsigned int chip, · line 599
Quoted 7 lines
drivers/char/cyclades.c +1
-6-/* 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 <[email protected]>
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 <[email protected]>
: AuthorDate: Sat Sep 19 13:13:16 2009 -0700
: Commit: Live-CD User <[email protected]>
: 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.
---
drivers/char/cyclades.c | 6 ------ 1 file changed, 6 deletions(-)
drivers/char/cyclades.c renamed from drivers/char/cyclades.c~char-cyclades-fix-compiler-warning +0 -6
@@ -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 ) {
_