linuxppc-dev.lists.ozlabs.org archive mirror
 help / color / mirror / Atom feed
* [PATCH] the wrong variable checked after request_irq()
@ 2007-07-15 19:59 Al Viro
  2007-07-15 21:40 ` Benjamin Herrenschmidt
  0 siblings, 1 reply; 4+ messages in thread
From: Al Viro @ 2007-07-15 19:59 UTC (permalink / raw)
  To: torvalds; +Cc: linuxppc-dev, linux-kernel


Signed-off-by: Al Viro <viro@zeniv.linux.org.uk>
---
 arch/powerpc/platforms/pseries/setup.c |    2 +-
 1 files changed, 1 insertions(+), 1 deletions(-)

diff --git a/arch/powerpc/platforms/pseries/setup.c b/arch/powerpc/platforms/pseries/setup.c
index 470db6e..a031d99 100644
--- a/arch/powerpc/platforms/pseries/setup.c
+++ b/arch/powerpc/platforms/pseries/setup.c
@@ -176,7 +176,7 @@ static void __init pseries_mpic_init_IRQ(void)
 		return;
 
 	cascade_irq = irq_of_parse_and_map(cascade, 0);
-	if (cascade == NO_IRQ) {
+	if (cascade_irq == NO_IRQ) {
 		printk(KERN_ERR "mpic: failed to map cascade interrupt");
 		return;
 	}
-- 
1.5.3.GIT

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

* Re: [PATCH] the wrong variable checked after request_irq()
  2007-07-15 19:59 [PATCH] the wrong variable checked after request_irq() Al Viro
@ 2007-07-15 21:40 ` Benjamin Herrenschmidt
  2007-07-15 22:02   ` Al Viro
  0 siblings, 1 reply; 4+ messages in thread
From: Benjamin Herrenschmidt @ 2007-07-15 21:40 UTC (permalink / raw)
  To: Al Viro; +Cc: linuxppc-dev, torvalds, linux-kernel

On Sun, 2007-07-15 at 20:59 +0100, Al Viro wrote:
> Signed-off-by: Al Viro <viro@zeniv.linux.org.uk>

Acked-by: Benjamin Herrenschmidt <benh@kernel.crashing.org>

Out of curiosity, how did you pick it up ? You have some automated tool
to catch that (or sparse changes) or you just did -lots- of code
inspection ?

Cheers,
Ben.

> ---
>  arch/powerpc/platforms/pseries/setup.c |    2 +-
>  1 files changed, 1 insertions(+), 1 deletions(-)
> 
> diff --git a/arch/powerpc/platforms/pseries/setup.c b/arch/powerpc/platforms/pseries/setup.c
> index 470db6e..a031d99 100644
> --- a/arch/powerpc/platforms/pseries/setup.c
> +++ b/arch/powerpc/platforms/pseries/setup.c
> @@ -176,7 +176,7 @@ static void __init pseries_mpic_init_IRQ(void)
>  		return;
>  
>  	cascade_irq = irq_of_parse_and_map(cascade, 0);
> -	if (cascade == NO_IRQ) {
> +	if (cascade_irq == NO_IRQ) {
>  		printk(KERN_ERR "mpic: failed to map cascade interrupt");
>  		return;
>  	}

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

* Re: [PATCH] the wrong variable checked after request_irq()
  2007-07-15 21:40 ` Benjamin Herrenschmidt
@ 2007-07-15 22:02   ` Al Viro
  2007-07-15 22:07     ` Benjamin Herrenschmidt
  0 siblings, 1 reply; 4+ messages in thread
From: Al Viro @ 2007-07-15 22:02 UTC (permalink / raw)
  To: Benjamin Herrenschmidt; +Cc: linuxppc-dev, torvalds, linux-kernel

On Mon, Jul 16, 2007 at 07:40:38AM +1000, Benjamin Herrenschmidt wrote:
> On Sun, 2007-07-15 at 20:59 +0100, Al Viro wrote:
> > Signed-off-by: Al Viro <viro@zeniv.linux.org.uk>
> 
> Acked-by: Benjamin Herrenschmidt <benh@kernel.crashing.org>
> 
> Out of curiosity, how did you pick it up ? You have some automated tool
> to catch that (or sparse changes) or you just did -lots- of code
> inspection ?

While testing sparse changes, actually (comparing pointers to null
pointer constant spelled without a cast to void *)...  That gave several
hundred hits, most of them being immediately obvious (picking the lines
by file and line number and looking through the list had eliminated all
but about a dozen or two).  Several were not...

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

* Re: [PATCH] the wrong variable checked after request_irq()
  2007-07-15 22:02   ` Al Viro
@ 2007-07-15 22:07     ` Benjamin Herrenschmidt
  0 siblings, 0 replies; 4+ messages in thread
From: Benjamin Herrenschmidt @ 2007-07-15 22:07 UTC (permalink / raw)
  To: Al Viro; +Cc: linuxppc-dev, torvalds, linux-kernel

On Sun, 2007-07-15 at 23:02 +0100, Al Viro wrote:
> On Mon, Jul 16, 2007 at 07:40:38AM +1000, Benjamin Herrenschmidt wrote:
> > On Sun, 2007-07-15 at 20:59 +0100, Al Viro wrote:
> > > Signed-off-by: Al Viro <viro@zeniv.linux.org.uk>
> > 
> > Acked-by: Benjamin Herrenschmidt <benh@kernel.crashing.org>
> > 
> > Out of curiosity, how did you pick it up ? You have some automated tool
> > to catch that (or sparse changes) or you just did -lots- of code
> > inspection ?
> 
> While testing sparse changes, actually (comparing pointers to null
> pointer constant spelled without a cast to void *)...  That gave several
> hundred hits, most of them being immediately obvious (picking the lines
> by file and line number and looking through the list had eliminated all
> but about a dozen or two).  Several were not...

Ok. In fact, it would have been nice if gcc had been able to pick it up
for another reason. The old code is:

	if (cascade == NULL)
		return;

	cascade_irq = irq_of_parse_and_map(cascade, 0);
	if (cascade == NO_IRQ) {
		printk(KERN_ERR "mpic: failed to map cascade interrupt");
		return;
	}

And NO_IRQ is 0 on powerpc nowadays. Thus the test can never be true :-)

But it looks like gcc doesn't pick that up.

Ben.

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

end of thread, other threads:[~2007-07-15 22:08 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2007-07-15 19:59 [PATCH] the wrong variable checked after request_irq() Al Viro
2007-07-15 21:40 ` Benjamin Herrenschmidt
2007-07-15 22:02   ` Al Viro
2007-07-15 22:07     ` Benjamin Herrenschmidt

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