diff options
author | Anton Vorontsov <avorontsov@ru.mvista.com> | 2008-12-18 08:23:29 +0000 |
---|---|---|
committer | David S. Miller <davem@davemloft.net> | 2008-12-18 22:50:50 -0800 |
commit | 67c2fb8ff0eda3cee95954a1dd245c3ce1a10486 (patch) | |
tree | e25dc49e42338225f25bb999aff0bebae8cb78a9 /drivers/net/ucc_geth.c | |
parent | 1762a29ae5ebdd974eb2ba0c36b56ab6f7a9c16d (diff) |
ucc_geth: Fix IRQ freeing code in ucc_geth_open()
open() routine calls stop() in case of errors, the function will try
to free the requested IRQ. But we don't know if it was actually
requested, so the code might issue bogus free_irq(0, dev) call.
Fix this by rearranging the code so that now request_irq() is the last
call in the open() routine, and move free_irq() into the close().
Signed-off-by: Anton Vorontsov <avorontsov@ru.mvista.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
Diffstat (limited to 'drivers/net/ucc_geth.c')
-rw-r--r-- | drivers/net/ucc_geth.c | 17 |
1 files changed, 8 insertions, 9 deletions
diff --git a/drivers/net/ucc_geth.c b/drivers/net/ucc_geth.c index 6ebefe951b9..3d1966c34d2 100644 --- a/drivers/net/ucc_geth.c +++ b/drivers/net/ucc_geth.c @@ -2300,8 +2300,6 @@ static void ucc_geth_stop(struct ucc_geth_private *ugeth) tempval &= ~(MACCFG1_ENABLE_RX | MACCFG1_ENABLE_TX); out_be32(&ug_regs->maccfg1, tempval); - free_irq(ugeth->ug_info->uf_info.irq, ugeth->dev); - ucc_geth_memclean(ugeth); } @@ -3759,21 +3757,20 @@ static int ucc_geth_open(struct net_device *dev) phy_start(ugeth->phydev); - err = - request_irq(ugeth->ug_info->uf_info.irq, ucc_geth_irq_handler, 0, - "UCC Geth", dev); + err = ugeth_enable(ugeth, COMM_DIR_RX_AND_TX); if (err) { if (netif_msg_ifup(ugeth)) - ugeth_err("%s: Cannot get IRQ for net device, aborting.", - dev->name); + ugeth_err("%s: Cannot enable net device, aborting.", dev->name); ucc_geth_stop(ugeth); goto out_err; } - err = ugeth_enable(ugeth, COMM_DIR_RX_AND_TX); + err = request_irq(ugeth->ug_info->uf_info.irq, ucc_geth_irq_handler, + 0, "UCC Geth", dev); if (err) { if (netif_msg_ifup(ugeth)) - ugeth_err("%s: Cannot enable net device, aborting.", dev->name); + ugeth_err("%s: Cannot get IRQ for net device, aborting.", + dev->name); ucc_geth_stop(ugeth); goto out_err; } @@ -3799,6 +3796,8 @@ static int ucc_geth_close(struct net_device *dev) ucc_geth_stop(ugeth); + free_irq(ugeth->ug_info->uf_info.irq, ugeth->dev); + phy_disconnect(ugeth->phydev); ugeth->phydev = NULL; |