LKML Archive on lore.kernel.org
help / color / mirror / Atom feed
* [PATCH] SUN3/3X Lance trivial fix improved
@ 2007-02-06 15:36 Cyrill V. Gorcunov
  0 siblings, 0 replies; 2+ messages in thread
From: Cyrill V. Gorcunov @ 2007-02-06 15:36 UTC (permalink / raw)
  To: Sam Creasey; +Cc: linux-kernel-list, Jiri Slaby

This patch adds checking for allocated DVMA memory
and granted IRQ line.

Signed-off-by: Cyrill V. Gorcunov <gorcunov@gmail.com>

---

Sam, this patch is almost the same I've already sent you
except of some improvements (thanks to Jiri Slaby) like
iounmap(), dvma_free() calls.

 drivers/net/sun3lance.c |   16 +++++++++++++++-
 1 files changed, 15 insertions(+), 1 deletions(-)

diff --git a/drivers/net/sun3lance.c b/drivers/net/sun3lance.c
index c62e85d..7bee45b 100644
--- a/drivers/net/sun3lance.c
+++ b/drivers/net/sun3lance.c
@@ -336,13 +336,27 @@ static int __init lance_probe( struct net_device *dev)
 
 	/* XXX - leak? */
 	MEM = dvma_malloc_align(sizeof(struct lance_memory), 0x10000);
+	if (MEM == NULL) {
+#ifdef CONFIG_SUN3
+		iounmap((void __iomem *)ioaddr);
+#endif
+		printk(KERN_WARNING "SUN3 Lance couldn't allocate DVMA memory\n");
+		return 0;
+	}
 
 	lp->iobase = (volatile unsigned short *)ioaddr;
 	dev->base_addr = (unsigned long)ioaddr; /* informational only */
 
 	REGA(CSR0) = CSR0_STOP;
 
-	request_irq(LANCE_IRQ, lance_interrupt, IRQF_DISABLED, "SUN3 Lance", dev);
+	if (request_irq(LANCE_IRQ, lance_interrupt, IRQF_DISABLED, "SUN3 Lance", dev) < 0) {
+#ifdef CONFIG_SUN3
+		iounmap((void __iomem *)ioaddr);
+#endif
+		dvma_free((void *)MEM);
+		printk(KERN_WARNING "SUN3 Lance unable to allocate IRQ\n");
+		return 0;
+	}
 	dev->irq = (unsigned short)LANCE_IRQ;
 
 

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

* [PATCH] SUN3/3X Lance trivial fix improved
@ 2007-03-15 18:05 Cyrill V. Gorcunov
  0 siblings, 0 replies; 2+ messages in thread
From: Cyrill V. Gorcunov @ 2007-03-15 18:05 UTC (permalink / raw)
  To: Andrew Morton; +Cc: linux-kernel-list

This patch adds checking for allocated DVMA memory
and granted IRQ line.

Signed-off-by: Cyrill V. Gorcunov <gorcunov@gmail.com>

---

Andrew, I've sent the patch almost the month ago...
It seems the patch was lost :(

drivers/net/sun3lance.c |   16 +++++++++++++++-
 1 files changed, 15 insertions(+), 1 deletions(-)

diff --git a/drivers/net/sun3lance.c b/drivers/net/sun3lance.c
index c62e85d..7bee45b 100644
--- a/drivers/net/sun3lance.c
+++ b/drivers/net/sun3lance.c
@@ -336,13 +336,27 @@ static int __init lance_probe( struct net_device *dev)
 
 	/* XXX - leak? */
 	MEM = dvma_malloc_align(sizeof(struct lance_memory), 0x10000);
+	if (MEM == NULL) {
+#ifdef CONFIG_SUN3
+		iounmap((void __iomem *)ioaddr);
+#endif
+		printk(KERN_WARNING "SUN3 Lance couldn't allocate DVMA memory\n");
+		return 0;
+	}
 
 	lp->iobase = (volatile unsigned short *)ioaddr;
 	dev->base_addr = (unsigned long)ioaddr; /* informational only */
 
 	REGA(CSR0) = CSR0_STOP;
 
-	request_irq(LANCE_IRQ, lance_interrupt, IRQF_DISABLED, "SUN3 Lance", dev);
+	if (request_irq(LANCE_IRQ, lance_interrupt, IRQF_DISABLED, "SUN3 Lance", dev) < 0) {
+#ifdef CONFIG_SUN3
+		iounmap((void __iomem *)ioaddr);
+#endif
+		dvma_free((void *)MEM);
+		printk(KERN_WARNING "SUN3 Lance unable to allocate IRQ\n");
+		return 0;
+	}
 	dev->irq = (unsigned short)LANCE_IRQ;
 
 

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

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

Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2007-02-06 15:36 [PATCH] SUN3/3X Lance trivial fix improved Cyrill V. Gorcunov
2007-03-15 18:05 Cyrill V. Gorcunov

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