aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/net
diff options
context:
space:
mode:
authorroel kluin <roel.kluin@gmail.com>2008-10-21 01:35:34 -0400
committerJeff Garzik <jgarzik@redhat.com>2008-10-22 06:22:07 -0400
commitd51894f4979e941a86309f29898579cbb591514e (patch)
treee848aec1028c068f0e8c6c381477c702df8e0787 /drivers/net
parente1564ec938b759268d6e67f24b5d6f429da4a5a9 (diff)
gianfar: fix handle errors returned by platform_get_irq*()
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>
Diffstat (limited to 'drivers/net')
-rw-r--r--drivers/net/gianfar.c24
1 files changed, 17 insertions, 7 deletions
diff --git a/drivers/net/gianfar.c b/drivers/net/gianfar.c
index b5bb7ae2817f..64b201134fdb 100644
--- a/drivers/net/gianfar.c
+++ b/drivers/net/gianfar.c
@@ -161,7 +161,7 @@ static int gfar_probe(struct platform_device *pdev)
161 struct gfar_private *priv = NULL; 161 struct gfar_private *priv = NULL;
162 struct gianfar_platform_data *einfo; 162 struct gianfar_platform_data *einfo;
163 struct resource *r; 163 struct resource *r;
164 int err = 0; 164 int err = 0, irq;
165 DECLARE_MAC_BUF(mac); 165 DECLARE_MAC_BUF(mac);
166 166
167 einfo = (struct gianfar_platform_data *) pdev->dev.platform_data; 167 einfo = (struct gianfar_platform_data *) pdev->dev.platform_data;
@@ -187,15 +187,25 @@ static int gfar_probe(struct platform_device *pdev)
187 187
188 /* fill out IRQ fields */ 188 /* fill out IRQ fields */
189 if (einfo->device_flags & FSL_GIANFAR_DEV_HAS_MULTI_INTR) { 189 if (einfo->device_flags & FSL_GIANFAR_DEV_HAS_MULTI_INTR) {
190 priv->interruptTransmit = platform_get_irq_byname(pdev, "tx"); 190 irq = platform_get_irq_byname(pdev, "tx");
191 priv->interruptReceive = platform_get_irq_byname(pdev, "rx"); 191 if (irq < 0)
192 priv->interruptError = platform_get_irq_byname(pdev, "error"); 192 goto regs_fail;
193 if (priv->interruptTransmit < 0 || priv->interruptReceive < 0 || priv->interruptError < 0) 193 priv->interruptTransmit = irq;
194
195 irq = platform_get_irq_byname(pdev, "rx");
196 if (irq < 0)
197 goto regs_fail;
198 priv->interruptReceive = irq;
199
200 irq = platform_get_irq_byname(pdev, "error");
201 if (irq < 0)
194 goto regs_fail; 202 goto regs_fail;
203 priv->interruptError = irq;
195 } else { 204 } else {
196 priv->interruptTransmit = platform_get_irq(pdev, 0); 205 irq = platform_get_irq(pdev, 0);
197 if (priv->interruptTransmit < 0) 206 if (irq < 0)
198 goto regs_fail; 207 goto regs_fail;
208 priv->interruptTransmit = irq;
199 } 209 }
200 210
201 /* get a pointer to the register memory */ 211 /* get a pointer to the register memory */