aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/net/macsonic.c
diff options
context:
space:
mode:
authorKulikov Vasiliy <segooon@gmail.com>2010-07-09 21:39:06 -0400
committerDavid S. Miller <davem@davemloft.net>2010-07-12 23:21:44 -0400
commit546e3abde391ef01ef4690e941611654343ea0bf (patch)
treef76dd44d1fe7d5d2f06fa178ca82033c09bf3ef5 /drivers/net/macsonic.c
parent62cd69a10683bd17a2454213b8c36a4399c533ab (diff)
macsonic: free irqs if sonic_open() fails
macsonic_open() doesn't check sonic_open() return code. If it is error we must free requested IRQs. Signed-off-by: Kulikov Vasiliy <segooon@gmail.com> Signed-off-by: Dan Carpenter <error27@gmail.com> Signed-off-by: David S. Miller <davem@davemloft.net>
Diffstat (limited to 'drivers/net/macsonic.c')
-rw-r--r--drivers/net/macsonic.c37
1 files changed, 28 insertions, 9 deletions
diff --git a/drivers/net/macsonic.c b/drivers/net/macsonic.c
index adb54fe2d82a..c93679ee6994 100644
--- a/drivers/net/macsonic.c
+++ b/drivers/net/macsonic.c
@@ -140,21 +140,40 @@ static irqreturn_t macsonic_interrupt(int irq, void *dev_id)
140 140
141static int macsonic_open(struct net_device* dev) 141static int macsonic_open(struct net_device* dev)
142{ 142{
143 if (request_irq(dev->irq, sonic_interrupt, IRQ_FLG_FAST, "sonic", dev)) { 143 int retval;
144 printk(KERN_ERR "%s: unable to get IRQ %d.\n", dev->name, dev->irq); 144
145 return -EAGAIN; 145 retval = request_irq(dev->irq, sonic_interrupt, IRQ_FLG_FAST,
146 "sonic", dev);
147 if (retval) {
148 printk(KERN_ERR "%s: unable to get IRQ %d.\n",
149 dev->name, dev->irq);
150 goto err;
146 } 151 }
147 /* Under the A/UX interrupt scheme, the onboard SONIC interrupt comes 152 /* Under the A/UX interrupt scheme, the onboard SONIC interrupt comes
148 * in at priority level 3. However, we sometimes get the level 2 inter- 153 * in at priority level 3. However, we sometimes get the level 2 inter-
149 * rupt as well, which must prevent re-entrance of the sonic handler. 154 * rupt as well, which must prevent re-entrance of the sonic handler.
150 */ 155 */
151 if (dev->irq == IRQ_AUTO_3) 156 if (dev->irq == IRQ_AUTO_3) {
152 if (request_irq(IRQ_NUBUS_9, macsonic_interrupt, IRQ_FLG_FAST, "sonic", dev)) { 157 retval = request_irq(IRQ_NUBUS_9, macsonic_interrupt,
153 printk(KERN_ERR "%s: unable to get IRQ %d.\n", dev->name, IRQ_NUBUS_9); 158 IRQ_FLG_FAST, "sonic", dev);
154 free_irq(dev->irq, dev); 159 if (retval) {
155 return -EAGAIN; 160 printk(KERN_ERR "%s: unable to get IRQ %d.\n",
161 dev->name, IRQ_NUBUS_9);
162 goto err_irq;
156 } 163 }
157 return sonic_open(dev); 164 }
165 retval = sonic_open(dev);
166 if (retval)
167 goto err_irq_nubus;
168 return 0;
169
170err_irq_nubus:
171 if (dev->irq == IRQ_AUTO_3)
172 free_irq(IRQ_NUBUS_9, dev);
173err_irq:
174 free_irq(dev->irq, dev);
175err:
176 return retval;
158} 177}
159 178
160static int macsonic_close(struct net_device* dev) 179static int macsonic_close(struct net_device* dev)