Skip to contentSkip to conversation

xtsonic: free irq if sonic_open() fails

PATCH Applied Kulikov Vasiliy 2 participants 2 messages Jul 10, 2010 – Jul 13, 2010

Subsystems (3)
lore
Share & tools
lore
#0 lore raw

PATCH 3/3 xtsonic: free irq if sonic_open() fails

xtsonic_open() doesn't check sonic_open() return code. If it is error we must free requested IRQ.

---
 drivers/net/xtsonic.c |   12 ++++++++++--
 1 files changed, 10 insertions(+), 2 deletions(-)
drivers/net/xtsonic.c +10 -2
index fdba9cb..9f12026 100644
@@ -93,12 +93,20 @@ static unsigned short known_revisions[]  
 static int xtsonic_open(struct net_device *dev)
 {
-	if (request_irq(dev->irq,sonic_interrupt,IRQF_DISABLED,"sonic",dev)) {
+	int retval;
+
+	retval = request_irq(dev->irq, sonic_interrupt, IRQF_DISABLED,
+				"sonic", dev);
+	if (retval) {
 		printk(KERN_ERR "%s: unable to get IRQ %d.\n",
 		       dev->name, dev->irq);
 		return -EAGAIN;
 	}
-	return sonic_open(dev);
+
+	retval = sonic_open(dev);
+	if (retval)
+		free_irq(dev->irq, dev);
+	return retval;
 }
 
 static int xtsonic_close(struct net_device *dev)
Signature · 1 line
1.7.0.4