Skip to content

Commit

Permalink
gianfar: fix handle errors returned by platform_get_irq*()
Browse files Browse the repository at this point in the history
platform_get_irq*() returns on -ENXIO when the resource cannot be
found, but this remains unnoticed if stored in an unsigned.

Signed-off-by: Roel Kluin <roel.kluin@gmail.com>
Signed-off-by: Jeff Garzik <jgarzik@redhat.com>
  • Loading branch information
roel kluin authored and Jeff Garzik committed Oct 22, 2008
1 parent e1564ec commit d51894f
Showing 1 changed file with 17 additions and 7 deletions.
24 changes: 17 additions & 7 deletions drivers/net/gianfar.c
Original file line number Diff line number Diff line change
Expand Up @@ -161,7 +161,7 @@ static int gfar_probe(struct platform_device *pdev)
struct gfar_private *priv = NULL;
struct gianfar_platform_data *einfo;
struct resource *r;
int err = 0;
int err = 0, irq;
DECLARE_MAC_BUF(mac);

einfo = (struct gianfar_platform_data *) pdev->dev.platform_data;
Expand All @@ -187,15 +187,25 @@ static int gfar_probe(struct platform_device *pdev)

/* fill out IRQ fields */
if (einfo->device_flags & FSL_GIANFAR_DEV_HAS_MULTI_INTR) {
priv->interruptTransmit = platform_get_irq_byname(pdev, "tx");
priv->interruptReceive = platform_get_irq_byname(pdev, "rx");
priv->interruptError = platform_get_irq_byname(pdev, "error");
if (priv->interruptTransmit < 0 || priv->interruptReceive < 0 || priv->interruptError < 0)
irq = platform_get_irq_byname(pdev, "tx");
if (irq < 0)
goto regs_fail;
priv->interruptTransmit = irq;

irq = platform_get_irq_byname(pdev, "rx");
if (irq < 0)
goto regs_fail;
priv->interruptReceive = irq;

irq = platform_get_irq_byname(pdev, "error");
if (irq < 0)
goto regs_fail;
priv->interruptError = irq;
} else {
priv->interruptTransmit = platform_get_irq(pdev, 0);
if (priv->interruptTransmit < 0)
irq = platform_get_irq(pdev, 0);
if (irq < 0)
goto regs_fail;
priv->interruptTransmit = irq;
}

/* get a pointer to the register memory */
Expand Down

0 comments on commit d51894f

Please sign in to comment.