jazzsonic: free irq if sonic_open() fails
authorKulikov Vasiliy <segooon@gmail.com>
Sat, 10 Jul 2010 01:00:35 +0000 (01:00 +0000)
committerDavid S. Miller <davem@davemloft.net>
Tue, 13 Jul 2010 03:21:44 +0000 (20:21 -0700)
jazzsonic_open() doesn't check sonic_open() return code. If it is error
we must free requested IRQ.

Signed-off-by: Kulikov Vasiliy <segooon@gmail.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
drivers/net/jazzsonic.c

index 3e6aaf9e5ce7c4060b1bc042cf4d46608549297a..949c1f9336445685998a891905924973c3eb7ef1 100644 (file)
@@ -82,11 +82,20 @@ static unsigned short known_revisions[] =
 
 static int jazzsonic_open(struct net_device* dev)
 {
-       if (request_irq(dev->irq, sonic_interrupt, IRQF_DISABLED, "sonic", dev)) {
-               printk(KERN_ERR "%s: unable to get IRQ %d.\n", dev->name, dev->irq);
-               return -EAGAIN;
+       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 retval;
        }
-       return sonic_open(dev);
+
+       retval = sonic_open(dev);
+       if (retval)
+               free_irq(dev->irq, dev);
+       return retval;
 }
 
 static int jazzsonic_close(struct net_device* dev)