* [PATCH 1/2] serial: 8250: Initialize pointer to irq_info
@ 2010-08-17 7:59 Michal Simek
2010-08-17 7:59 ` [PATCH 2/2] serial: 8250pci: Recast inb return value Michal Simek
2010-08-17 8:17 ` [PATCH 1/2] serial: 8250: Initialize pointer to irq_info Alan Cox
0 siblings, 2 replies; 9+ messages in thread
From: Michal Simek @ 2010-08-17 7:59 UTC (permalink / raw)
To: michal.simek
Cc: Michal Simek, Greg Kroah-Hartman, Alan Cox, Andrew Morton,
Ralf Baechle, Manuel Lauss, linux-serial, linux-kernel
Initialize "i" irq_info pointer in serial_unlink_irq_chain.
Compilation warning:
CC drivers/serial/8250.o
drivers/serial/8250.c: In function 'serial8250_shutdown':
drivers/serial/8250.c:1701: warning: 'i' may be used uninitialized in this function
Signed-off-by: Michal Simek <monstr@monstr.eu>
CC: Greg Kroah-Hartman <gregkh@suse.de>
CC: Alan Cox <alan@linux.intel.com>
CC: Andrew Morton <akpm@linux-foundation.org>
CC: Ralf Baechle <ralf@linux-mips.org>
CC: Manuel Lauss <manuel.lauss@googlemail.com>
CC: linux-serial@vger.kernel.org
CC: linux-kernel@vger.kernel.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 24110f6..6c847d3 100644
--- a/drivers/serial/8250.c
+++ b/drivers/serial/8250.c
@@ -1698,7 +1698,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.5.5.6
^ permalink raw reply related [flat|nested] 9+ messages in thread* [PATCH 2/2] serial: 8250pci: Recast inb return value
2010-08-17 7:59 [PATCH 1/2] serial: 8250: Initialize pointer to irq_info Michal Simek
@ 2010-08-17 7:59 ` Michal Simek
2010-08-17 8:21 ` Alan Cox
2010-08-17 10:04 ` Alan Cox
2010-08-17 8:17 ` [PATCH 1/2] serial: 8250: Initialize pointer to irq_info Alan Cox
1 sibling, 2 replies; 9+ messages in thread
From: Michal Simek @ 2010-08-17 7:59 UTC (permalink / raw)
To: michal.simek
Cc: Michal Simek, Andrew Morton, Greg Kroah-Hartman, Alan Cox,
Lennert Buytenhek, Lytochkin Boris, linux-serial, linux-kernel
inb returns u8 that's why is necessary to do recast.
Compilation warning:
CC drivers/serial/8250_pci.o
drivers/serial/8250_pci.c: In function 'pci_ite887x_init':
drivers/serial/8250_pci.c:825: warning: cast to pointer from integer of different size
Signed-off-by: Michal Simek <monstr@monstr.eu>
CC: Andrew Morton <akpm@linux-foundation.org>
CC: Greg Kroah-Hartman <gregkh@suse.de>
CC: Alan Cox <alan@linux.intel.com>
CC: Lennert Buytenhek <buytenh@wantstofly.org>
CC: Lytochkin Boris <lytboris@gmail.com>
CC: linux-serial@vger.kernel.org
CC: linux-kernel@vger.kernel.org
---
drivers/serial/8250_pci.c | 2 +-
1 files changed, 1 insertions(+), 1 deletions(-)
diff --git a/drivers/serial/8250_pci.c b/drivers/serial/8250_pci.c
index 53be4d3..cc11faa 100644
--- a/drivers/serial/8250_pci.c
+++ b/drivers/serial/8250_pci.c
@@ -822,7 +822,7 @@ static int pci_ite887x_init(struct pci_dev *dev)
/* write INTCBAR - ioport */
pci_write_config_dword(dev, ITE_887x_INTCBAR,
inta_addr[i]);
- ret = inb(inta_addr[i]);
+ ret = (int) inb(inta_addr[i]);
if (ret != 0xff) {
/* ioport connected */
break;
--
1.5.5.6
^ permalink raw reply related [flat|nested] 9+ messages in thread* Re: [PATCH 2/2] serial: 8250pci: Recast inb return value
2010-08-17 7:59 ` [PATCH 2/2] serial: 8250pci: Recast inb return value Michal Simek
@ 2010-08-17 8:21 ` Alan Cox
2010-08-17 10:04 ` Alan Cox
1 sibling, 0 replies; 9+ messages in thread
From: Alan Cox @ 2010-08-17 8:21 UTC (permalink / raw)
To: Michal Simek
Cc: michal.simek, Andrew Morton, Greg Kroah-Hartman,
Lennert Buytenhek, Lytochkin Boris, linux-serial, linux-kernel
On Tue, 17 Aug 2010 09:59:07 +0200
Michal Simek <monstr@monstr.eu> wrote:
> inb returns u8 that's why is necessary to do recast.
>
> Compilation warning:
> CC drivers/serial/8250_pci.o
> drivers/serial/8250_pci.c: In function 'pci_ite887x_init':
> drivers/serial/8250_pci.c:825: warning: cast to pointer from integer
NAK - this makes no sense at all
^ permalink raw reply [flat|nested] 9+ messages in thread
* Re: [PATCH 2/2] serial: 8250pci: Recast inb return value
2010-08-17 7:59 ` [PATCH 2/2] serial: 8250pci: Recast inb return value Michal Simek
2010-08-17 8:21 ` Alan Cox
@ 2010-08-17 10:04 ` Alan Cox
2010-08-17 10:09 ` Michal Simek
1 sibling, 1 reply; 9+ messages in thread
From: Alan Cox @ 2010-08-17 10:04 UTC (permalink / raw)
To: Michal Simek
Cc: Andrew Morton, Greg Kroah-Hartman, Alan Cox, Lennert Buytenhek,
Lytochkin Boris, linux-serial, linux-kernel
On Tue, 17 Aug 2010 09:59:07 +0200
Michal Simek <monstr@monstr.eu> wrote:
> inb returns u8 that's why is necessary to do recast.
ret is an int, inb returns a u8, neither are pointers and the cast
required is implict and defined by the spec.
> drivers/serial/8250_pci.c: In function 'pci_ite887x_init':
> drivers/serial/8250_pci.c:825: warning: cast to pointer from integer of different size
^ permalink raw reply [flat|nested] 9+ messages in thread
* Re: [PATCH 2/2] serial: 8250pci: Recast inb return value
2010-08-17 10:04 ` Alan Cox
@ 2010-08-17 10:09 ` Michal Simek
0 siblings, 0 replies; 9+ messages in thread
From: Michal Simek @ 2010-08-17 10:09 UTC (permalink / raw)
To: Alan Cox; +Cc: linux-serial, linux-kernel
Alan Cox wrote:
> On Tue, 17 Aug 2010 09:59:07 +0200
> Michal Simek <monstr@monstr.eu> wrote:
>
>> inb returns u8 that's why is necessary to do recast.
>
> ret is an int, inb returns a u8, neither are pointers and the cast
> required is implict and defined by the spec.
ok. I am using gcc 4.1.2 which is likely the reason why I see that warnings.
Michal
--
Michal Simek, Ing. (M.Eng)
w: www.monstr.eu p: +42-0-721842854
Maintainer of Linux kernel 2.6 Microblaze Linux - http://www.monstr.eu/fdt/
Microblaze U-BOOT custodian
^ permalink raw reply [flat|nested] 9+ messages in thread
* Re: [PATCH 1/2] serial: 8250: Initialize pointer to irq_info
2010-08-17 7:59 [PATCH 1/2] serial: 8250: Initialize pointer to irq_info Michal Simek
2010-08-17 7:59 ` [PATCH 2/2] serial: 8250pci: Recast inb return value Michal Simek
@ 2010-08-17 8:17 ` Alan Cox
2010-08-17 8:56 ` Michal Simek
2010-08-19 23:43 ` Andrew Morton
1 sibling, 2 replies; 9+ messages in thread
From: Alan Cox @ 2010-08-17 8:17 UTC (permalink / raw)
To: Michal Simek
Cc: michal.simek, Greg Kroah-Hartman, Andrew Morton, Ralf Baechle,
Manuel Lauss, linux-serial, linux-kernel
On Tue, 17 Aug 2010 09:59:06 +0200
Michal Simek <monstr@monstr.eu> wrote:
> Initialize "i" irq_info pointer in serial_unlink_irq_chain.
>
> Compilation warning:
> CC drivers/serial/8250.o
> drivers/serial/8250.c: In function 'serial8250_shutdown':
> drivers/serial/8250.c:1701: warning: 'i' may be used uninitialized in
> this function
NAK (again)
Use a newer compiler - modern ones get this right.
^ permalink raw reply [flat|nested] 9+ messages in thread
* Re: [PATCH 1/2] serial: 8250: Initialize pointer to irq_info
2010-08-17 8:17 ` [PATCH 1/2] serial: 8250: Initialize pointer to irq_info Alan Cox
@ 2010-08-17 8:56 ` Michal Simek
2010-08-19 23:43 ` Andrew Morton
1 sibling, 0 replies; 9+ messages in thread
From: Michal Simek @ 2010-08-17 8:56 UTC (permalink / raw)
To: Alan Cox
Cc: michal.simek, Greg Kroah-Hartman, Andrew Morton, Ralf Baechle,
Manuel Lauss, linux-serial, linux-kernel
Alan Cox wrote:
> On Tue, 17 Aug 2010 09:59:06 +0200
> Michal Simek <monstr@monstr.eu> wrote:
>
>> Initialize "i" irq_info pointer in serial_unlink_irq_chain.
>>
>> Compilation warning:
>> CC drivers/serial/8250.o
>> drivers/serial/8250.c: In function 'serial8250_shutdown':
>> drivers/serial/8250.c:1701: warning: 'i' may be used uninitialized in
>> this function
>
> NAK (again)
>
> Use a newer compiler - modern ones get this right.
I wasn't sure if is bug or not.
Thanks,
Michal
--
Michal Simek, Ing. (M.Eng)
w: www.monstr.eu p: +42-0-721842854
Maintainer of Linux kernel 2.6 Microblaze Linux - http://www.monstr.eu/fdt/
Microblaze U-BOOT custodian
^ permalink raw reply [flat|nested] 9+ messages in thread
* Re: [PATCH 1/2] serial: 8250: Initialize pointer to irq_info
2010-08-17 8:17 ` [PATCH 1/2] serial: 8250: Initialize pointer to irq_info Alan Cox
2010-08-17 8:56 ` Michal Simek
@ 2010-08-19 23:43 ` Andrew Morton
2010-08-20 10:31 ` Alan Cox
1 sibling, 1 reply; 9+ messages in thread
From: Andrew Morton @ 2010-08-19 23:43 UTC (permalink / raw)
To: Alan Cox
Cc: Michal Simek, michal.simek, Greg Kroah-Hartman, Ralf Baechle,
Manuel Lauss, linux-serial, linux-kernel
On Tue, 17 Aug 2010 09:17:20 +0100
Alan Cox <alan@linux.intel.com> wrote:
> On Tue, 17 Aug 2010 09:59:06 +0200
> Michal Simek <monstr@monstr.eu> wrote:
>
> > Initialize "i" irq_info pointer in serial_unlink_irq_chain.
> >
> > Compilation warning:
> > CC drivers/serial/8250.o
> > drivers/serial/8250.c: In function 'serial8250_shutdown':
> > drivers/serial/8250.c:1701: warning: 'i' may be used uninitialized in
> > this function
>
> NAK (again)
>
> Use a newer compiler - modern ones get this right.
: static void serial_unlink_irq_chain(struct uart_8250_port *up)
: {
: struct irq_info *i;
: struct hlist_node *n;
: struct hlist_head *h;
:
: mutex_lock(&hash_mutex);
:
: h = &irq_lists[up->port.irq % NR_IRQ_HASH];
:
: hlist_for_each(n, h) {
: i = hlist_entry(n, struct irq_info, node);
: if (i->irq == up->port.irq)
: break;
: }
:
: BUG_ON(n == NULL);
: BUG_ON(i->head == NULL);
How can any compiler possibly determine that the hlist_for_each() is
never executed zero times?
^ permalink raw reply [flat|nested] 9+ messages in thread* Re: [PATCH 1/2] serial: 8250: Initialize pointer to irq_info
2010-08-19 23:43 ` Andrew Morton
@ 2010-08-20 10:31 ` Alan Cox
0 siblings, 0 replies; 9+ messages in thread
From: Alan Cox @ 2010-08-20 10:31 UTC (permalink / raw)
To: Andrew Morton
Cc: Alan Cox, Michal Simek, michal.simek, Greg Kroah-Hartman,
Ralf Baechle, Manuel Lauss, linux-serial, linux-kernel
> > Use a newer compiler - modern ones get this right.
>
> : static void serial_unlink_irq_chain(struct uart_8250_port *up)
> : {
> : struct irq_info *i;
> : struct hlist_node *n;
> : struct hlist_head *h;
> :
> : mutex_lock(&hash_mutex);
> :
> : h = &irq_lists[up->port.irq % NR_IRQ_HASH];
> :
> : hlist_for_each(n, h) {
> : i = hlist_entry(n, struct irq_info, node);
> : if (i->irq == up->port.irq)
> : break;
> : }
> :
> : BUG_ON(n == NULL);
> : BUG_ON(i->head == NULL);
>
> How can any compiler possibly determine that the hlist_for_each() is
> never executed zero times?
We had this argument was it two years ago ?
Modern gcc is capable of at least working out it can't work it out and
doesn't emit a spurious warning.
^ permalink raw reply [flat|nested] 9+ messages in thread
end of thread, other threads:[~2010-08-20 10:16 UTC | newest]
Thread overview: 9+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2010-08-17 7:59 [PATCH 1/2] serial: 8250: Initialize pointer to irq_info Michal Simek
2010-08-17 7:59 ` [PATCH 2/2] serial: 8250pci: Recast inb return value Michal Simek
2010-08-17 8:21 ` Alan Cox
2010-08-17 10:04 ` Alan Cox
2010-08-17 10:09 ` Michal Simek
2010-08-17 8:17 ` [PATCH 1/2] serial: 8250: Initialize pointer to irq_info Alan Cox
2010-08-17 8:56 ` Michal Simek
2010-08-19 23:43 ` Andrew Morton
2010-08-20 10:31 ` Alan Cox
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox