Message ID | 49F5917A.3060909@gmail.com |
---|---|
State | Deferred, archived |
Delegated to: | David Miller |
Headers | show |
On Mon, 27 Apr 2009 13:05:30 +0200 Roel Kluin <roel.kluin@gmail.com> wrote: > priv->interruptTransmit, -Receive and -Error are unsigned, so the error path > wasn't taken when irq_of_parse_and_map() returned an incorrect irq. > > Signed-off-by: Roel Kluin <roel.kluin@gmail.com> > --- > diff --git a/drivers/net/gianfar.c b/drivers/net/gianfar.c > index b2c4967..55c2ce8 100644 > --- a/drivers/net/gianfar.c > +++ b/drivers/net/gianfar.c > @@ -203,9 +203,9 @@ static int gfar_of_init(struct net_device *dev) > > priv->interruptError = irq_of_parse_and_map(np, 2); > > - if (priv->interruptTransmit < 0 || > - priv->interruptReceive < 0 || > - priv->interruptError < 0) { > + if (priv->interruptTransmit == NO_IRQ || > + priv->interruptReceive == NO_IRQ || > + priv->interruptError == NO_IRQ) { > err = -EINVAL; > goto err_out; > } I guess that's OK, as gianfar.c appears to be a ppc-only thing, and ppc does implement NO_IRQ. However what a lot (all) rtc drivers do is if (irq <= 0) which (afaik) will dtrt in all cases: NO_IRQ==0, NO_IRQ<0, !defined(NO_IRQ). Then again, it will dtwt if the platform allows irq numbers of zero. argh, how did we get into this pickle? -- To unsubscribe from this list: send the line "unsubscribe netdev" in the body of a message to majordomo@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html
diff --git a/drivers/net/gianfar.c b/drivers/net/gianfar.c index b2c4967..55c2ce8 100644 --- a/drivers/net/gianfar.c +++ b/drivers/net/gianfar.c @@ -203,9 +203,9 @@ static int gfar_of_init(struct net_device *dev) priv->interruptError = irq_of_parse_and_map(np, 2); - if (priv->interruptTransmit < 0 || - priv->interruptReceive < 0 || - priv->interruptError < 0) { + if (priv->interruptTransmit == NO_IRQ || + priv->interruptReceive == NO_IRQ || + priv->interruptError == NO_IRQ) { err = -EINVAL; goto err_out; }
priv->interruptTransmit, -Receive and -Error are unsigned, so the error path wasn't taken when irq_of_parse_and_map() returned an incorrect irq. Signed-off-by: Roel Kluin <roel.kluin@gmail.com> --- -- To unsubscribe from this list: send the line "unsubscribe netdev" in the body of a message to majordomo@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html