Commit dbe000ed3f3033e8e6321d79023c827faf649c4d
Committed by
David S. Miller
1 parent
546e3abde3
Exists in
master
and in
7 other branches
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 <segooon@gmail.com> Signed-off-by: David S. Miller <davem@davemloft.net>
Showing 1 changed file with 10 additions and 2 deletions Side-by-side Diff
drivers/net/xtsonic.c
... | ... | @@ -93,12 +93,20 @@ |
93 | 93 | |
94 | 94 | static int xtsonic_open(struct net_device *dev) |
95 | 95 | { |
96 | - if (request_irq(dev->irq,sonic_interrupt,IRQF_DISABLED,"sonic",dev)) { | |
96 | + int retval; | |
97 | + | |
98 | + retval = request_irq(dev->irq, sonic_interrupt, IRQF_DISABLED, | |
99 | + "sonic", dev); | |
100 | + if (retval) { | |
97 | 101 | printk(KERN_ERR "%s: unable to get IRQ %d.\n", |
98 | 102 | dev->name, dev->irq); |
99 | 103 | return -EAGAIN; |
100 | 104 | } |
101 | - return sonic_open(dev); | |
105 | + | |
106 | + retval = sonic_open(dev); | |
107 | + if (retval) | |
108 | + free_irq(dev->irq, dev); | |
109 | + return retval; | |
102 | 110 | } |
103 | 111 | |
104 | 112 | static int xtsonic_close(struct net_device *dev) |