From: Kulikov Vasiliy Date: Sat, 10 Jul 2010 01:01:44 +0000 (+0000) Subject: xtsonic: free irq if sonic_open() fails X-Git-Url: https://git.karo-electronics.de/?a=commitdiff_plain;h=dbe000ed3f3033e8e6321d79023c827faf649c4d;p=linux-beck.git 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. Signed-off-by: Kulikov Vasiliy Signed-off-by: David S. Miller --- diff --git a/drivers/net/xtsonic.c b/drivers/net/xtsonic.c index fdba9cb3a599..9f12026d98e7 100644 --- a/drivers/net/xtsonic.c +++ b/drivers/net/xtsonic.c @@ -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)