aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/net
diff options
context:
space:
mode:
authorCyrill V. Gorcunov <gorcunov@gmail.com>2007-03-27 01:47:26 -0400
committerJeff Garzik <jeff@garzik.org>2007-03-28 02:18:51 -0400
commitc14bac628b9fad6fd4dad8fbb9e864c61a8924c9 (patch)
tree9f0dbaa87f077fbbf250414db91a1fb4fc66dfa2 /drivers/net
parentfadac4060c0456ce0a190ee581746ae8663f84e1 (diff)
SUN3/3X Lance trivial fix improved
This patch adds checking for allocated DVMA memory and granted IRQ line. Signed-off-by: Cyrill V. Gorcunov <gorcunov@gmail.com> Signed-off-by: Andrew Morton <akpm@linux-foundation.org> Signed-off-by: Jeff Garzik <jeff@garzik.org>
Diffstat (limited to 'drivers/net')
-rw-r--r--drivers/net/sun3lance.c16
1 files changed, 15 insertions, 1 deletions
diff --git a/drivers/net/sun3lance.c b/drivers/net/sun3lance.c
index c62e85d89f41..7bee45b42a2c 100644
--- a/drivers/net/sun3lance.c
+++ b/drivers/net/sun3lance.c
@@ -336,13 +336,27 @@ static int __init lance_probe( struct net_device *dev)
336 336
337 /* XXX - leak? */ 337 /* XXX - leak? */
338 MEM = dvma_malloc_align(sizeof(struct lance_memory), 0x10000); 338 MEM = dvma_malloc_align(sizeof(struct lance_memory), 0x10000);
339 if (MEM == NULL) {
340#ifdef CONFIG_SUN3
341 iounmap((void __iomem *)ioaddr);
342#endif
343 printk(KERN_WARNING "SUN3 Lance couldn't allocate DVMA memory\n");
344 return 0;
345 }
339 346
340 lp->iobase = (volatile unsigned short *)ioaddr; 347 lp->iobase = (volatile unsigned short *)ioaddr;
341 dev->base_addr = (unsigned long)ioaddr; /* informational only */ 348 dev->base_addr = (unsigned long)ioaddr; /* informational only */
342 349
343 REGA(CSR0) = CSR0_STOP; 350 REGA(CSR0) = CSR0_STOP;
344 351
345 request_irq(LANCE_IRQ, lance_interrupt, IRQF_DISABLED, "SUN3 Lance", dev); 352 if (request_irq(LANCE_IRQ, lance_interrupt, IRQF_DISABLED, "SUN3 Lance", dev) < 0) {
353#ifdef CONFIG_SUN3
354 iounmap((void __iomem *)ioaddr);
355#endif
356 dvma_free((void *)MEM);
357 printk(KERN_WARNING "SUN3 Lance unable to allocate IRQ\n");
358 return 0;
359 }
346 dev->irq = (unsigned short)LANCE_IRQ; 360 dev->irq = (unsigned short)LANCE_IRQ;
347 361
348 362